title: Access memcached object in model (Phalcon)
body: <p>Following this <a href="http://phalcon-php-framework-documentation.readthedocs.org/en/latest/reference/models-cache.html#caching-related-records-recursively" rel="nofollow">document</a>, I'm trying to retrieve memcached key within find() method in a model (in order to get cache version of the model&amp;relations).</p>
  
  <p>Does somebody know how should i access the memcached object which i set at the DI?</p>
  
  <pre><code>class Tags extends Phalcon\Mvc\Model {
  
  protected  function _getCache($key)
  {
      // how do i retreive memcached object?
  
  }
  
  protected static function _setCache($key)
  {
      // stores data in the cache
  }
  </code></pre>
  
  <p>these are the settings as they are in DI:</p>
  
  <pre><code>$di-&gt;set('modelsCache', function()
      {
          //Cache data for one day by default
          $frontCache = new \Phalcon\Cache\Frontend\Data(array(
                  "lifetime" =&gt; 86400
          ));
  
          //Memcached connection settings
          $cache = new \Phalcon\Cache\Backend\Memcache($frontCache, array(
                  "host" =&gt; "localhost",
                  "port" =&gt; "11211"
          ));
          return $cache;
  
      });
  </code></pre>