You are here

function radioactivity_write_memcache_entry in Radioactivity 5

Same name and namespace in other branches
  1. 6 radioactivity.inc \radioactivity_write_memcache_entry()
1 call to radioactivity_write_memcache_entry()
radioactivity_add_energy in ./radioactivity.inc
Add energy to nodes.

File

./radioactivity.inc, line 241

Code

function radioactivity_write_memcache_entry($entry) {
  $mc = dmemcache_object('radioactivity');

  // get id sequence for new entry
  $id_key = dmemcache_key('entry_id_seq', 'radioactivity');
  $id = $mc
    ->increment($id_key);
  if (!$id) {
    $id = 0;
    $mc
      ->add($id_key, $id);
  }

  // put the entry into memcache
  $entry_key = dmemcache_key('entry-' . $id, 'radioactivity');
  return dmemcache_set('entry-' . $id, $entry, radioactivity_get_memcached_expiration(), 'radioactivity');
}