public function getObject($identity)
 {
     $scopedId = $this->scopeId($identity);
     $object = SimpleSAML_Memcache::get($scopedId);
     if (is_array($object) && (!array_key_exists('expire', $object) || $object['expire'] >= time())) {
         return $object;
     } else {
         return null;
     }
 }
 /**
  * This function is used to find an existing storage object. It will return NULL if no storage object
  * with the given id is found.
  *
  * @param $id  The id of the storage object we are looking for. A id consists of lowercase
  *             alphanumeric characters.
  * @return The corresponding MemcacheStorage object if the data is found or NULL if it isn't found.
  */
 public static function find($id)
 {
     assert(self::isValidID($id));
     $serializedData = SimpleSAML_Memcache::get($id);
     if ($serializedData === NULL) {
         return NULL;
     }
     $data = unserialize($serializedData);
     if (!$data instanceof self) {
         SimpleSAML_Logger::warning('Retrieved key from memcache did not contain a MemcacheStore object.');
         return NULL;
     }
     return $data;
 }
 /**
  * Retrieve a value from the datastore.
  *
  * @param string $type  The datatype.
  * @param string $key  The key.
  * @return mixed|NULL  The value.
  */
 public function get($type, $key)
 {
     assert('is_string($type)');
     assert('is_string($key)');
     return SimpleSAML_Memcache::get('simpleSAMLphp.' . $type . '.' . $key);
 }
 /**
  * @param $ticketId string
  * @return array|null
  */
 public function getTicket($ticketId)
 {
     $scopedTicketId = $this->scopeTicketId($ticketId);
     return SimpleSAML_Memcache::get($scopedTicketId);
 }
            continue;
        }
        $items = $state['curr_items'];
        echo "Server " . $server . " has " . $items . " items.\n";
        $serverKeys = getServerKeys($server);
        $keys = array_merge($keys, $serverKeys);
    }
}
echo "Total number of keys: " . count($keys) . "\n";
$keys = array_unique($keys);
echo "Total number of unique keys: " . count($keys) . "\n";
echo "Starting synchronization.\n";
$skipped = 0;
$sync = 0;
foreach ($keys as $key) {
    $res = SimpleSAML_Memcache::get($key);
    if ($res === NULL) {
        $skipped += 1;
    } else {
        $sync += 1;
    }
}
echo "Synchronization done.\n";
echo $sync . " keys in sync.\n";
if ($skipped > 0) {
    echo $skipped . " keys skipped.\n";
    echo "Keys are skipped because they are either expired, or are of a type unknown\n";
    echo "to simpleSAMLphp.\n";
}
if ($warnServerDown > 0) {
    echo "WARNING: " . $warnServerDown . " server(s) down. Not all servers are synchronized.\n";
Beispiel #6
0
 protected static function cacheGET($calID)
 {
     return json_decode(SimpleSAML_Memcache::get('calendar-' . $calID), TRUE);
 }