Explorar el Código

[GENERIC] Zend_Translate:

- unified cache handling

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22591 44c647ce-9c0f-0410-b52a-842ac1e357ba
thomas hace 15 años
padre
commit
c11df8cab4
Se han modificado 1 ficheros con 13 adiciones y 16 borrados
  1. 13 16
      library/Zend/Translate.php

+ 13 - 16
library/Zend/Translate.php

@@ -24,6 +24,11 @@
  */
 require_once 'Zend/Loader.php';
 
+/**
+ * @see Zend_Translate_Adapter
+ */
+require_once 'Zend/Translate/Adapter.php';
+
 
 /**
  * @category   Zend
@@ -54,7 +59,6 @@ class Zend_Translate {
      * @var Zend_Translate_Adapter
      */
     private $_adapter;
-    private static $_cache = null;
 
     /**
      * Generates the standard translation object
@@ -128,11 +132,7 @@ class Zend_Translate {
         }
 
         if (array_key_exists('cache', $options)) {
-            self::setCache($options['cache']);
-        }
-
-        if (self::$_cache !== null) {
-            $options['cache'] = self::getCache();
+            Zend_Translate_Adapter::setCache($options['cache']);
         }
 
         $adapter = $options['adapter'];
@@ -161,7 +161,7 @@ class Zend_Translate {
      */
     public static function getCache()
     {
-        return self::$_cache;
+        return Zend_Translate_Adapter::getCache();
     }
 
     /**
@@ -172,7 +172,7 @@ class Zend_Translate {
      */
     public static function setCache(Zend_Cache_Core $cache)
     {
-        self::$_cache = $cache;
+        Zend_Translate_Adapter::setCache($cache);
     }
 
     /**
@@ -182,11 +182,7 @@ class Zend_Translate {
      */
     public static function hasCache()
     {
-        if (self::$_cache !== null) {
-            return true;
-        }
-
-        return false;
+        return Zend_Translate_Adapter::hasCache();
     }
 
     /**
@@ -196,17 +192,18 @@ class Zend_Translate {
      */
     public static function removeCache()
     {
-        self::$_cache = null;
+        Zend_Translate_Adapter::removeCache();
     }
 
     /**
      * Clears all set cache data
      *
+     * @param string $tag Tag to clear when the default tag name is not used
      * @return void
      */
-    public static function clearCache()
+    public static function clearCache($tag = null)
     {
-        self::$_cache->clean();
+        Zend_Translate_Adapter::clearCache($tag);
     }
 
     /**