poseidon-memcached
Version:
A future wrapper around the Node Memcached driver using Poseidon.
40 lines (31 loc) • 1.3 kB
text/coffeescript
Driver
======
The `Driver` class stores configurations for multiple caches. It also caches
the clients for quick access and reuse.
Memcached = require 'memcached'
class Driver
: {}
: {}
: (connName, connConfig) ->
throw new Error('Configuration object required') unless connConfig?
[connName] = connConfig.servers
return
: (connName) ->
throw Error('Connection not configured') unless [connName]?
if [connName]? then return [connName]
[connName] = new Memcached([connName])
: (connName) ->
throw Error('Connection does not exist') unless [connName]?
[connName].end()
delete [connName]
return
: () ->
for connName, connConfig of
if [connName]? then (connName)
delete [connName]
return
: () ->
for connName, connConfig of
if [connName]? then (connName)
return
module.exports = Driver