Displaying 1 result from an estimated 1 matches for "blah_by_user_id".
2006 Dec 11
4
creating a cache in rails
...so attempted to create a singleton class (include
Singleton) outside of the controller and that didn''t work either.
Here is the singleton class that I created to cache the information.
Any help would be appreciated. Thanks.
class BlahMemStore
include Singleton
def initialize()
@blah_by_user_id = {}
end
def add(blah_data, user_id)
@blah_by_user_id[user_id] = blah_data
end
def remove(user_id)
@blah_by_user_id[user_id] = nil
end
def find(user_id)
return @blah_by_user_id[user_id]
end
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~-----...