A month ago Shopify was at BigRubyConf where we mentioned an internal library we use for caching…

What Exactly is IdentityCache?
Down to the Numbers


Specifying Indexes
class Product < ActiveRecord::Base include IdentityCache end Product.fetch(id) class Product < ActiveRecord::Base include IdentityCache cache_index :handle end Product.fetch_by_handle(handle)
class Product < ActiveRecord::Base include IdentityCache cache_index :shop_id, :id end Product.fetch_by_shop_id_and_id(shop_id, id)
Caching Associations
class Product < ActiveRecord::Base include IdentityCache has_many :images cache_has_many :images end @product = Product.fetch(id) @images = @product.fetch_images
Embedding Associations
class Product < ActiveRecord::Base include IdentityCache has_many :images cache_has_many :images, :embed => true end @product = Product.fetch(id) @images = @product.fetch_images

A number of publishers have curtailed your rights by rigging their ebooks so that you can't do what you can with a dead-tree book: you can't freely lend, borrow, resell or donate them. Some DRM systems even firmly tie them to a specific reading device; buying a new device means buying those same ebooks all over again!









