OpenSource For You

IMPORTANT FUNCTIONS

-

A Memcached client mostly has the following functions available, whatever the programmin­g environmen­t it may be in: • get(key)— Retrieve the value associated with the speci

fied key • set(key, value, expiry)— Add or replace the given key's

value along with the given expiry times • add(key, value, expiry)— Add a value associated with the new key in Memcached; if the key already exists, it returns an error. • append(key)— Add the current data at the end of the

value that is already associated with the key. • prepend(key)— Add the current data before what

already exists, and which is associated with the key. • delete(key)— Delete or invalidate the key. • replace(key, value)— Replace the value of the existing key in Memcached. Returns an error if the associated key does not already exist. • flush_all()— Invalidate­s all keys in Memcached memory. size depends on the slab class that the page has been assigned. The page a particular data is assigned to depends on the actual size of the data, including the key and the value, according to which it is given a page of a relevant slab class. For example, a page that is 1 MB in size and belongs to Slab Class 1 will have eight 128 KB sized chunks. So, if a key-value pair is 109 KB in size, it is likely to be assigned a chunk of 128 KB in a page of this slab class (yes, 19 KB is wasted, but that’s the trade-off). Now, it is important to note that the LRU algorithm discussed earlier works only on a per-slab basis. So, a key is likely to be evicted earlier if the slab it belongs to is being used more than others.

Newspapers in English

Newspapers from India