コード例 #1
0
 /**
  * Gets the language from memcache or inserts it
  * @param array $tag
  * @return array
  */
 public function getLanguage($tag, $fallback = false)
 {
     if ($tag == '') {
         return false;
     }
     $language = $this->memCache->get($this->getCacheKey($tag));
     if (!$language) {
         $query = $this->repository->getLanguageByTag($tag);
         $query->execute();
         $language = $query->fetch();
         if ($language) {
             $this->memCache->set($this->getCacheKey($tag), $language);
         } elseif (!$fallback) {
             $insert = $this->repository->insertLanguageFromTag($tag);
             $insert->execute();
             $language = $this->getLanguage($tag, true);
         }
     }
     return $language;
 }
コード例 #2
0
 /**
  * Gets the country from memcache or inserts it
  * @param array $tag
  * @return array
  */
 public function getCountry($tag, $fallback = false)
 {
     if ($tag == '') {
         return false;
     }
     $country = $this->memCache->get($this->getCacheKey($tag));
     if (!$country) {
         $query = $this->repository->getCountryByAlpha($tag);
         $query->execute();
         $country = $query->fetch();
         if ($country) {
             $this->memCache->set($this->getCacheKey($tag), $country);
         } elseif (!$fallback) {
             $insert = $this->repository->insertCountryFromAlpha($tag);
             $insert->execute();
             $country = $this->getCountry($tag, true);
         }
     }
     return $country;
 }
コード例 #3
0
 public function delete($key)
 {
     return parent::delete($this->app['memcache.namespace'] . $key);
 }