Sha256: b20e84b4c2cae92b90173c7e0a3a0c5ef9e257a429749260e4e18f9748262dbe
Contents?: true
Size: 803 Bytes
Versions: 1
Compression:
Stored size: 803 Bytes
Contents
module FoodInfo module CacheAdapters class MemCacheCompatible def initialize(obj = nil) if obj && obj.respond_to?(:get) && obj.respond_to?(:set) @cache = obj else raise "FoodInfo::CacheAdapters::MemCacheCompatible must be initialized with an object that responds to get and set (look into the Dalli gem)" end end def set(key, val) begin @cache.set(key, val) rescue Exception => e STDERR.puts "FoodInfo Cache Error (set): #{e}" end val end def get(key) begin @cache.get(key) rescue Exception => e STDERR.puts "FoodInfo Cache Error (get): #{e}" return nil end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
food_info-0.0.7 | lib/food_info/cache_adapters/mem_cache_compatible.rb |