Stumblecache is a high performance shared memory cache that scales to tens of gigabytes of cache, thousands of requests per second, and high update rates. It was created to allow Stumbleupon to cache large amounts of short ttl url data on our webserver and worker tiers.
You can think of it as a replacement for the user caching portion of apc, though different tradeoffs have been made and stumblecache will be less space efficient in most cases.
- MMAP based
- Fixed allocations ie. 500k 2k cache blocks
- stumblecache.location: the path where all the caches are stored
__construct( nrOfItems, itemSize )
- nrOfItems is the maximum number of items in the cache.
- itemSize is the size of each item in the cache.
- rounded up to nearest 4kb (or pagesize)
The cache will use nrOfItems * itemSize amount of memory, plus some overhead.
__construct ( cacheRef )
- cacheRef: string: name of the cache
page 0: meta-data
- cache file version: 4 bytes
- item size: 4 bytes
- nr of items: 4 bytes
- next data page: 4 bytes
page 1-x: index, b-tree
b-tree node: 1023 keys, 1024 children
- leaf: yes/no byte
- nrOfKeys: 1-1023 2 bytes
key: 8 bytes
value idx: 4 bytes number = idx into data block
expire ts: 2 bytes
flags: 2 bytes
- in use: 1 bit
This extension is released under the PHP 3.01 license, see LICENSE file for details
This product includes PHP software, freely available from <http://www.php.net/software/>