Class | MemCache |
In: |
lib/memcache.rb
|
Parent: | Object |
A Ruby client library for memcached.
This is intended to provide access to basic memcached functionality. It does not attempt to be complete implementation of the entire API.
In particular, the methods of this class are not thread safe. The calling application is responsible for implementing any necessary locking if a cache object will be called from multiple threads.
GENERAL_ERROR | = | /^ERROR\r\n/ | Patterns for matching against server error replies. | |
CLIENT_ERROR | = | /^CLIENT_ERROR/ | ||
SERVER_ERROR | = | /^SERVER_ERROR/ | ||
DEFAULT_OPTIONS | = | { :namespace => nil, :readonly => false | Default options for the cache object. | |
DEFAULT_PORT | = | 11211 | Default memcached port. | |
DEFAULT_WEIGHT | = | 1 | Default memcached server weight. |
request_timeout | [RW] | The amount of time to wait for a response from a memcached server. If a response is not completed within this time, the connection to the server will be closed and an error will be raised. |
Valid options are:
:namespace If specified, all keys will have the given value prepended before accessing the cache. Defaults to nil. :readonly If this is set, any attempt to write to the cache will generate an exception. Defaults to false.
Reset the connection to all memcache servers. This should be called if there is a problem with a cache lookup that might have left the connection in a corrupted state.
Set the servers that the requests will be distributed between. Entries can be either strings of the form "hostname:port" or "hostname:port:weight" or MemCache::Server objects.