Mercurial > hg > memcached
view t/unixsocket.t @ 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
#!/usr/bin/perl use strict; use Test::More tests => 3; use FindBin qw($Bin); use lib "$Bin/lib"; use MemcachedTest; my $filename = "/tmp/memcachetest$$"; my $server = new_memcached("-s $filename"); my $sock = $server->sock; ok(-S $filename, "creating unix domain socket $filename"); # set foo (and should get it) print $sock "set foo 0 0 6\r\nfooval\r\n"; is(scalar <$sock>, "STORED\r\n", "stored foo"); mem_get_is($sock, "foo", "fooval"); unlink($filename); ## Just some basic stuff for now...