Doctrine 1
  1. Doctrine 1
  2. DC-390

doctrine_cache_keys bigger than 1mb

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.1
    • Fix Version/s: None
    • Component/s: Caching
    • Labels:
      None

      Description

      When multiple projects using doctrine use the same memcached server the doctrine_cache_keys can get bigger then 1mb and php will be throwing warnings telling that the data is too big to be stored by memcached.

      I am currently using a workaround, having 1 doctrine_cache_keys per application, on the file Cache/Driver.php i added the following line to the constructor

      $this->_cacheKeyIndexKey = 'doctrine_cache_keys_' . md5(Doctrine_Manager::getInstance()->getCurrentConnection()->getOption('dsn'));
      

      but if an application uses more than 1mb en keys then the notice will rise again.

        Issue Links

          Activity

          Hide
          circlechu added a comment -

          Why doctrine need to save the keys when it is timeout? I found doctrine will hold the duplicated keys in doctrine_cache_keys map. So this is why it will become more and more bigger. So I think if I remove those duplicated key it will be better? Here is my solution
          I add array_unique function to remove all duplicated keys in the map. This method is in the Doctrine_Cache_Driver class.

          /**

          • Save a cache key in the index of cache keys
            *
          • @param string $key
          • @return boolean True if successful and false if something went wrong.
            */
            protected function _saveKey($key) { $keys = $this->fetch($this->_cacheKeyIndexKey); $keys[] = $key; $keys=array_unique ($keys); return $this->save($this->_cacheKeyIndexKey, $keys, null, false); }
          Show
          circlechu added a comment - Why doctrine need to save the keys when it is timeout? I found doctrine will hold the duplicated keys in doctrine_cache_keys map. So this is why it will become more and more bigger. So I think if I remove those duplicated key it will be better? Here is my solution I add array_unique function to remove all duplicated keys in the map. This method is in the Doctrine_Cache_Driver class. /** Save a cache key in the index of cache keys * @param string $key @return boolean True if successful and false if something went wrong. */ protected function _saveKey($key) { $keys = $this->fetch($this->_cacheKeyIndexKey); $keys[] = $key; $keys=array_unique ($keys); return $this->save($this->_cacheKeyIndexKey, $keys, null, false); }

            People

            • Assignee:
              Jonathan H. Wage
              Reporter:
              Douglas Yau
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: