예제 #1
0
 public function testSerializerJSON()
 {
     $config = function_exists('cache_config') ? cache_config() : array();
     $cache = new fCache(CACHE_TYPE, cache_data_store(), array_merge(array('serializer' => array('fJSON', 'encode'), 'unserializer' => array('fJSON', 'decode')), $config));
     $cache->set('testkey', TRUE);
     $this->assertEquals(TRUE, $cache->get('testkey'));
     $cache->set('testkey', FALSE);
     $this->assertEquals(FALSE, $cache->get('testkey'));
 }
예제 #2
0
 /**
  * Sets the schema info to be cached to the fCache object specified
  *
  * @param  fCache $cache      The cache to cache to
  * @param  string $key_token  Internal use only! (this will be used in the cache key to uniquely identify the cache for this fDatabase object)
  * @return void
  */
 public function enableCaching($cache, $key_token = NULL)
 {
     $this->cache = $cache;
     if ($key_token !== NULL) {
         $this->cache_prefix = 'fDatabase::' . $this->type . '::' . $key_token . '::';
     }
     $this->schema_info = $this->cache->get($this->makeCachePrefix() . 'schema_info', array());
 }
예제 #3
0
 /**
  * Sets the schema to be cached to the fCache object specified
  * 
  * @param  fCache $cache  The cache to cache to
  * @return void
  */
 public function enableCaching($cache)
 {
     $this->cache = $cache;
     $prefix = $this->makeCachePrefix();
     $this->column_info = $this->cache->get($prefix . 'column_info', array());
     $this->databases = $this->cache->get($prefix . 'databases', NULL);
     $this->keys = $this->cache->get($prefix . 'keys', array());
     if (!$this->column_info_override && !$this->keys_override) {
         $this->merged_column_info = $this->cache->get($prefix . 'merged_column_info', array());
         $this->merged_keys = $this->cache->get($prefix . 'merged_keys', array());
         $this->relationships = $this->cache->get($prefix . 'relationships', array());
     }
     $this->tables = $this->cache->get($prefix . 'tables', NULL);
 }
예제 #4
0
 /**
  * Sets the schema to be cached to the fCache object specified
  *
  * @param  fCache $cache      The cache to cache to
  * @param  string $key_token  Internal use only! (this will be used in the cache key to uniquely identify the cache for this fSchema object)
  * @return void
  */
 public function enableCaching($cache, $key_token = NULL)
 {
     $this->cache = $cache;
     if ($key_token !== NULL) {
         $this->cache_prefix = 'fSchema::' . $this->database->getType() . '::' . $key_token . '::';
     }
     $prefix = $this->makeCachePrefix();
     $this->column_info = $this->cache->get($prefix . 'column_info', array());
     $this->databases = $this->cache->get($prefix . 'databases', NULL);
     $this->keys = $this->cache->get($prefix . 'keys', array());
     if (!$this->column_info_override && !$this->keys_override) {
         $this->merged_column_info = $this->cache->get($prefix . 'merged_column_info', array());
         $this->merged_keys = $this->cache->get($prefix . 'merged_keys', array());
         $this->relationships = $this->cache->get($prefix . 'relationships', array());
     }
     $this->tables = $this->cache->get($prefix . 'tables', NULL);
 }
예제 #5
0
 /**
  * Callback to read a session's values
  * 
  * @internal
  *
  * @param  string $id  The session to read
  * @return string  The session's serialized data
  */
 public static function readCache($id)
 {
     return self::$backend->get(self::$key_prefix . $id, '');
 }
예제 #6
0
 /**
  * Sets the schema info to be cached to the fCache object specified
  * 
  * @param  fCache $cache  The cache to cache to
  * @return void
  */
 public function enableCaching($cache)
 {
     $this->cache = $cache;
     $this->schema_info = $this->cache->get($this->makeCachePrefix() . 'schema_info', array());
 }