Mercurial > hg > memcached
view items.h @ 2:e28ab6bd21fa
Append/prepend commands.
Introduce new storage commands "append" and "prepend" for atomic value
modification. They follow generic storage commands interface as described in
doc/protocol.txt:
<command name> <key> <flags> <exptime> <bytes>\r\n
<data block>\r\n
Current implementation involves memcpy() twice to combine values on writing
(i.e. full resulting value are copied), but truly atomic (and even threadsafe).
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sun, 30 Sep 2007 04:14:57 +0400 |
parents | 30782bb1fc04 |
children |
line wrap: on
line source
/* See items.c */ void item_init(void); /*@null@*/ item *do_item_alloc(char *key, const size_t nkey, const int flags, const rel_time_t exptime, const int nbytes); void item_free(item *it); bool item_size_ok(const size_t nkey, const int flags, const int nbytes); int do_item_link(item *it); /* may fail if transgresses limits */ void do_item_unlink(item *it); void do_item_remove(item *it); void do_item_update(item *it); /* update LRU time to current and reposition */ int do_item_replace(item *it, item *new_it); /*@null@*/ char *item_cachedump(const unsigned int slabs_clsid, const unsigned int limit, unsigned int *bytes); void item_stats(char *buffer, const int buflen); /*@null@*/ char *item_stats_sizes(int *bytes); void do_item_flush_expired(void); item *item_get(const char *key, const size_t nkey); item *do_item_get_notedeleted(const char *key, const size_t nkey, bool *delete_locked); item *do_item_get_nocheck(const char *key, const size_t nkey);