예제 #1
0
파일: Cache.php 프로젝트: agentile/foresmo
 /**
  * 
  * Test -- Disallow all calls to methods besides factory() and the existing support methods.
  * 
  */
 public final function test__call()
 {
     // we use `new` instead of Solar::factory() so that we get back the
     // factory class itself, not an adapter generated by the factory
     $obj = new Solar_Cache($this->_config);
     try {
         $obj->noSuchMethod();
         $this->fail('__call() should not work');
     } catch (Exception $e) {
         $this->assertTrue(true);
     }
 }
예제 #2
0
 /**
  * Deletes a document from the database
  * 
  * @param JForg_Dodb_Document $doc The document to delete
  * 
  * @return void
  * @author Bahtiar Gadimov <*****@*****.**>
  */
 public function delete(JForg_Dodb_Document $doc)
 {
     if ($this->_caching) {
         $this->_cache->delete($doc->fetchDocumentId());
     }
     $this->_delete($doc->fetchDocumentId(), $doc->fetchSpecialProperty('_rev'));
 }
예제 #3
0
파일: Cache.php 프로젝트: btweedy/foresmo
 /**
  * 
  * Test -- Disallow all calls to methods besides factory() and the existing support methods.
  * 
  */
 public function test__call()
 {
     $obj = new Solar_Cache();
     try {
         $obj->noSuchMethod();
         $this->fail('__call() should not work');
     } catch (Exception $e) {
         $this->assertTrue(true);
     }
 }
예제 #4
0
 /**
  * 
  * Fetches the public key data from TypeKey.
  * 
  * If a cache object was injected at construction time, uses
  * a cached version of the public key instead of hitting the
  * TypeKey server.
  * 
  * The URI used is "http://www.typekey.com/extras/regkeys.txt".
  * 
  * @return array An array with keys 'p', 'q', 'g', and 'pub_key'
  * as extracted from the fetched key string.
  * 
  */
 protected function _fetchKeyData()
 {
     $cache_key = $this->_config['cache_key'];
     if ($this->_cache) {
         $info = $this->_cache->fetch($cache_key);
         if ($info) {
             // cache hit
             return $info;
         }
     }
     // cache miss, or no cache.  get from typekey.
     $src = file_get_contents('http://www.typekey.com/extras/regkeys.txt');
     $lines = explode(' ', trim($src));
     foreach ($lines as $line) {
         $val = explode('=', $line);
         $info[$val[0]] = $val[1];
     }
     // save in the cache?
     if ($this->_cache) {
         $this->_cache->save($cache_key, $info);
     }
     // done
     return $info;
 }