Well, yes, the point of caching is to trade memory for performance.
memcached is very scalable - for example, one popular social networking service reported in 2008 that they operated over 800 memcached servers, delivering 28TB of available cache memory.
Whats the advantage of moving your schema into ruby?
I found Hstore invaluable when using STI, because ActiveRecord's column-proliferation approach is an ORM wart of the highest order but I didn't really want to go MongoDB just yet.
I concur with Kevin. I've come to Ruby & Rails with a background in other programming languages and frameworks (C, Perl, Scheme and Java). The rails API doco is somewhat half-baked, so I am very interested in deep-dive walkthroughs and I have no problem keeping up. And the pause button is there if one needs to chew on the substance a little more.
Another usage tip. To make creates work (e.g. when using accepts_nested_attributes_for), you'll need serialize :properties, ActiveRecord::Coders::Hstore in your model (assuming your hstore field is called "properties").
I've seen suggestions that this need will go away with Rails 4.0.
Four years later - I would say, put them in a JSONB field and sort using PostgreSQL's native support for it.
When a memcached server runs low on memory, it simply removes the oldest data.
Well, yes, the point of caching is to trade memory for performance.
memcached is very scalable - for example, one popular social networking service reported in 2008 that they operated over 800 memcached servers, delivering 28TB of available cache memory.
I found Hstore invaluable when using STI, because ActiveRecord's column-proliferation approach is an ORM wart of the highest order but I didn't really want to go MongoDB just yet.
I concur with Kevin. I've come to Ruby & Rails with a background in other programming languages and frameworks (C, Perl, Scheme and Java). The rails API doco is somewhat half-baked, so I am very interested in deep-dive walkthroughs and I have no problem keeping up. And the pause button is there if one needs to chew on the substance a little more.
nice piece, also for the neat metaprogramming example!
NB: playback cuts off a little, missing the last couple of seconds.
Nominating this article for an update.
Another usage tip. To make creates work (e.g. when using accepts_nested_attributes_for), you'll need
serialize :properties, ActiveRecord::Coders::Hstore
in your model (assuming your hstore field is called "properties").I've seen suggestions that this need will go away with Rails 4.0.
How about a bit of DRY. I have this in lib/hstore_accessor.rb ( see https://gist.github.com/2834785 ):
and in config/initializers/active_record_extensions.rb
require "hstore_accessor"
Then we can do