public function testGetName()
 {
     $delegate = $this->getMock('Geocoder\\Provider\\Provider');
     $cache = $this->getMock('Doctrine\\Common\\Cache\\Cache');
     $provider = new Cache($cache, $delegate);
     $this->assertEquals('cache', $provider->getName());
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function reverse($latitude, $longitude)
 {
     $key = 'geocoder_' . sha1($this->locale . $latitude . $longitude);
     if (false !== ($data = $this->cache->fetch($key))) {
         return unserialize($data);
     }
     $data = $this->provider->reverse($latitude, $longitude);
     $this->cache->save($key, serialize($data), $this->lifetime);
     return $data;
 }