Hi,
I am using memcahced_client for caching. I also have cached_model installed as a gem install. I have a user object that in turn has a hasmany relationship to a reviews model.
So, once user logs in, i have soemthing like
@reviews = @user_profile.reviews
and reviews has been defined as follows in the user_profile model
# Reviews has_many :reviews, :class_name => "UserReviews", :foreign_key => :user_id, :limit => 1000, :order => :review_date
I then try to cache the @reviews using
Cache.put key,@reviews.
Next i try to retreive it using
Cache.get key
Here is my code for that. begin @reviews = Cache.get @user_profile.user_id.to_s+'_reviews' rescue @reviews = nil end if @reviews == nil @reviews = @user_profile.reviews Cache.put @user_profile.user_id.to_s+'_reviews', @reviews end
Neither the put nor the get seem to be working. I think it has something to do with the marshalling. Can anyone help?
Thanks in advance Deepa.