You are here

function radioactivity_write_memcache_entry in Radioactivity 6

Same name and namespace in other branches
  1. 5 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 272

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 === FALSE) {

    // initialize sequence
    $id = 0;
    $mc
      ->add($id_key, $id);
    dmemcache_set('entry_id_processed', 0, 0, 'radioactivity');
  }

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