Method: EAAL::Cache::MemcachedCache#save
- Defined in:
- lib/eaal/cache/memcached.rb
#save(userid, apikey, scope, name, args, xml) ⇒ Object
Saves to cache. It is worth noting that memcached handles expiry for us unlike FileCache as a result, there is no requirement for a validate_cache method- we just get MC to expire the key when we can go get a new copy.
18 19 20 21 22 23 24 |
# File 'lib/eaal/cache/memcached.rb', line 18 def save(userid, apikey, scope, name, args, xml) k = key(userid, apikey, scope, name, args) cached_until = Time.parse(xml.match(/<cachedUntil>(.+)<\/cachedUntil>/)[1]) expires_in = (name=='WalletJournal' ? cached_until.to_i+3600 : cached_until.to_i ) $cache.delete(k) $cache.add(k,xml,expires_in) end |