happyfish100 / libshmcache

libshmcache is a local cache in the share memory for multi processes. high performance due to read is lockless. libshmcache is 100+ times faster than a remote interface such as redis.
449 stars 136 forks source link
cache key-value lockless shared-memory

Copyright (C) 2016 Happy Fish / YuQing

libshmcache may be copied or modified under the terms of BSD License.

libshmcache is a local share memory cache for multi processes. it is a high performance library because read mechanism is lockless. libshmcache is 100+ times faster than a remote interface such as redis.

this project contains C library, PHP extension and Java JNI wrapper.

Its high performance features include:

stable features are:

other features are:

utility commands in directory: src/tools, in /usr/bin/ after make && make install

libshmcache PHP extension is supplied in the directory: php-shmcache, support PHP 5 and PHP 7

ShmCache::__construct(string $config_filename[, long $serializer = ShmCache::SERIALIZER_IGBINARY])

boolean ShmCache::set(string $key, mixed $value, long $ttl)

long ShmCache::incr(string $key, long $increment, long $ttl)

mixed ShmCache::get(string $key[, boolean $returnExpired = false])

long ShmCache::getExpires(string $key[, boolean $returnExpired = false])

boolean ShmCache::setExpires(string $key, long $expires)

boolean ShmCache::setTTL(string $key, long $ttl)

boolean ShmCache::delete(string $key)

array ShmCache::stats()

boolean ShmCache::clear()