Depcached - memcache(d) with dependencies

When using memcache we bumped into some problems. The major one was that we needed to invalidate data due to some content that was updated. For this we took a fresh look at memcache, and made our own derivative, depcached. Short for Dependency Cache.

It is available for all to download and use. Version 1.0.1 and newer now also supports simple queues. Will document it a bit better soon...

Please note that the PHP extension was missing in the 1.0.1 release. You can download the 1.0.2 release when you want to use it.

In the depcached tar we also included the code for the php client. Just use phpize, configure and make install to install the client. Don't forget to adapt your php.ini to load it as an extension.

We also provide the Anymeta_Cache.php source code.

How to use depcached

Depcached is very similar to memcache. Though at the moment depcached only supports a subset of the command set of memcache.

We support:

  • set key locked exptime datasz dep-keys
  • get key
  • delete key exptime
  • flush_all
  • flush key
  • queue key queue-len locked exptime datasz dep-keys
  • dequeue key
  • version
  • quit
  • stats

Queues in depcached

Queues are simple fifo queues with a fixed size. With the queue command you can add something to a queue. The get command will return you the complete queue. The dequeue command will send the oldest item in the queue and will afterwards remove it from the queue.

With every queue command you can change the length of the queue.

At the moment there is no option to get the number of items in a queue.

A small example

<?php

$depcached = depcached_connect('localhost', 31307);

if ($depcached) 
{
    $depcached->set("str_key", "String to store in depcached");
    $depcached->set("num_key", 123);

    $object = new StdClass;
    $object->attribute = 'test';
    $depcached->set("obj_key", $object);

    $array = Array('assoc'=>123, 345, 567);
    $depcached->set("arr_key", $array);

    echo '<pre>';
    var_dump($depcached->get('str_key'));
    var_dump($depcached->get('num_key'));
    var_dump($depcached->get('obj_key'));
    var_dump($depcached->get('arr_key'));
    

    $depcached->set("a/b/c", "Some value for a/b/c", 0, 0, "x y");
    var_dump($depcached->get('a/b/c'));

    $depcached->flush("x");
    var_dump($depcached->get('a/b/c'));

    $depcached->set('x', 'hello world');
    $depcached->delete('x');
}
else
{
    echo "Connection to depcached failed";
}

?>

downloads

php download technical code anymeta opensource gpl software oauth ruby

mmcached - a hierarchical extension to memcached

There is a new and better version of this memcached clone. Please check ou...

oauth-php - Google Code

A PHP library for OAuth consumers and servers. Complete with an extensible OAuth store, includi...

OAuth Server And Consumer in PHP

Here is the full implementation of OAuth for anyMeta. For now we...

Verso Wiki: translate Wiki markup to HTML and HTML to Wiki markup

Verso Wiki is a Wiki to HTML and HTML to Wiki markup translator. We use this W...

OAuth - Added Body Signing

I just published a new version of our OAuth server and consumer code. The major addition to thi...

Securing your site against code injections

All Internet applications have to secure their inner workings against attacks from outside. We a...

Facebook Developers | Thrift

Thrift is a software framework for scalable cross-language services development. It combines a po...

anyMeta 3.2.3 - brings big changes under the hood

I just tagged anyMeta 3.2.3. It is a small version number change that incorporates big changes u...

Sorting Digital Photos

More and more people collect a growing mountain of digital photos. I try to manage that nice mo...

Download / eZComponents

eZ Publish is an open source content management system (CMS) and an open source content managemen...

software download opensource php technical code photos gpl freeware macosx

OAuth - Added Body Signing

I just published a new version of our OAuth server and consumer code. The major addition to thi...

Facebook Developers | Thrift

Thrift is a software framework for scalable cross-language services development. It combines a po...

Sorting Digital Photos

More and more people collect a growing mountain of digital photos. I try to manage that nice mo...

Download / eZComponents

eZ Publish is an open source content management system (CMS) and an open source content managemen...

oauth download code anymeta opensource technical gpl php mediamatic google

oauth-php - Google Code

A PHP library for OAuth consumers and servers. Complete with an extensible OAuth store, includi...

OAuth Server And Consumer in PHP

Here is the full implementation of OAuth for anyMeta. For now we...

OAuth - Added Body Signing

I just published a new version of our OAuth server and consumer code. The major addition to thi...

mmcache memcached mmcached anymeta php cache technical code memcache danga

mmcached - a hierarchical extension to memcached

There is a new and better version of this memcached clone. Please check ou...

anyMeta 3.2.3 - brings big changes under the hood

I just tagged anyMeta 3.2.3. It is a small version number change that incorporates big changes u...

MarcWorrell.com/ created on 2007-08-10 14:28:01/ modified on 2008-01-22 12:26:38/ mail me at