コード例 #1
0
ファイル: Redis.php プロジェクト: vanslambrouckd/geotools
 /**
  * {@inheritDoc}
  */
 public function cache(BatchGeocoded $geocoded)
 {
     $this->redis->set($key = $this->getKey($geocoded->getProviderName(), $geocoded->getQuery()), $this->serialize($geocoded));
     if ($this->expire > 0) {
         $this->redis->expire($key, $this->expire);
     }
 }
コード例 #2
0
ファイル: MongoDB.php プロジェクト: vanslambrouckd/geotools
 /**
  * {@inheritDoc}
  */
 public function cache(BatchGeocoded $geocoded)
 {
     try {
         $this->collection->insert(array_merge(array('id' => $this->getKey($geocoded->getProviderName(), $geocoded->getQuery())), $this->normalize($geocoded)));
     } catch (\Exception $e) {
         throw new RuntimeException($e->getMessage());
     }
 }
コード例 #3
0
ファイル: Memcached.php プロジェクト: vanslambrouckd/geotools
 /**
  * {@inheritDoc}
  */
 public function cache(BatchGeocoded $geocoded)
 {
     $this->memcached->set($this->getKey($geocoded->getProviderName(), $geocoded->getQuery()), $this->serialize($geocoded), $this->expire);
 }