poseidon-memcached
Version:
A future wrapper around the Node Memcached driver using Poseidon.
32 lines (27 loc) • 648 B
text/coffeescript
Cache
=====
The `Cache` class represent a memcache server in which objects can be cached
and retrieved.
Driver = require './driver'
poseidon = require 'poseidon'
class Cache
constructor: (connName) ->
@_connName = connName
@_cache = Driver.openConnection @_connName
[
'get'
'gets'
'getMulti'
'add'
'set'
'del'
'cas'
'flush'
].forEach (fn) ->
@[fn] = poseidon.wrap @_cache, fn
, @
return
end: () ->
Driver.closeConnection @_connName
return
module.exports = Cache