The New Memcache?


#1

Hey All !

I ended up browsing to Eric H.'s blog the other night, and found his
entry about the new cache_model and memcache-client.
Now, it looks like it’s “officially” out in the open:
http://weblog.rubyonrails.com/articles/2006/01/20/caching-models-with-memcached

In my application, I’ve been staying away from caching my models, and
instead just doing lookups based on different ID’s that I pass around.
I
heard that this was a good practice, as your sessioned models could
become
inconsisent (ie: if it was updated).

Now, it looks like this may be a moot point, as the cache_model
implements
ActiveRecord::Locking, and the memcache-client solves some performance
issues.
Is this the case ?

It would indeed be much easier to store some models in the session,
than
to do lookups all over the place, so was just wondering what other
people
think.
Let me know what you think, and forgive my ignorance if I any of my
statements above are incorrect :slight_smile:

Dylan


#2

On Jan 20, 2006, at 2:01 PM, Dylan S. wrote:

I ended up browsing to Eric H.'s blog the other night, and found
his entry about the new cache_model and memcache-client.

I don’t have a blog yet :wink: Its the company’s blog.

implements ActiveRecord::Locking, and the memcache-client solves
some performance issues.
Is this the case ?

You need to add the lock_version columns to your tables if you don’t
want nasty surprises in your database:

Active Records support optimistic locking if the field
lock_version is present.

http://api.rubyonrails.com/classes/ActiveRecord/Locking.html

It would indeed be much easier to store some models in the
session, than to do lookups all over the place, so was just
wondering what other people think.
Let me know what you think, and forgive my ignorance if I any of my
statements above are incorrect :slight_smile:

Just store the id of the model in the session and let cached_model
take care of the rest of it. No sense storing the model in memcached
twice.


Eric H. - removed_email_address@domain.invalid - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com


#3

Ahh… thanks for clearing up some of the confusion I had Eric :slight_smile: