Store the cache data in memcache
965632
public function store($key, $data, $lifetime = 0)
    {

        if ($lifetime != 0) {
            $lifetime = \time() + $lifetime;
        }

        $data = array($lifetime, $data);

        $this->hash[$key] = $data;

        if ($key != $this->catalog_key) {
            $this->catalogKeyAdd($key, $lifetime);
        }

        return true;
    }
1056392
def store(bank, key, data, cachedir=None):
    '''
    
    '''
    if cachedir is None:
        cachedir = __opts__['cachedir']

    try:
        cache = salt.cache.Cache(__opts__, cachedir=cachedir)
    except TypeError:
        cache = salt.cache.Cache(__opts__)
    return cache.store(bank, key, data)
627234
protected function _storeData() {
		if ($this->_currentCellIsDirty) {
			$this->_currentObject->detach();

			fseek($this->_fileHandle,0,SEEK_END);
			$offset = ftell($this->_fileHandle);
			fwrite($this->_fileHandle, serialize($this->_currentObject));
			$this->_cellCache[$this->_currentObjectID]	= array('ptr' => $offset,
																'sz'  => ftell($this->_fileHandle) - $offset
															   );
			$this->_currentCellIsDirty = false;
		}
		$this->_currentObjectID = $this->_currentObject = null;
	}
1186386
def cache(self):
        """"""
        with open(self.cache_path, "wb") as f:
            cache = {self.CACHE_REFERENCE_LIST: self._references,
                     self.CACHE_REFERENCE_TYPES: self.reference_types,
                     self.CACHE_REFERENCE_TEMPLATES: self.reference_templates}
            pickle.dump(cache, f)
345584
def store(key, value, options = {})
      @cache.store(key, value, options)
      @adapter.store(key, value, options)
    end
393061
public function cache()
    {
        $keys = [
            'enable_caching',
            'cache_duration'
        ];
        $this->CacheSettings = $this->loadModel('Wasabi/Core.CacheSettings');
        $settings = $this->CacheSettings->getKeyValues(new CacheSetting(), $keys);
        if ($this->request->is('post') && !empty($this->request->data)) {
            $settings = $this->CacheSettings->newEntity($this->request->data);
            if (!$settings->errors()) {
                if ($this->CacheSettings->saveKeyValues($settings, $keys)) {
                    $this->Flash->success(__d('wasabi_core', 'The cache settings have been updated.'));
                    $this->redirect(['action' => 'cache']);
                    return;
                } else {
                    $this->Flash->error($this->dbErrorMessage);
                }
            } else {
                $this->Flash->error($this->formErrorMessage);
            }
        }
        $this->set([
            'settings' => $settings,
            'cacheDurations' => $this->CacheSettings->cacheDurations
        ]);
    }
62646
private function connect()
  {
    if ($this->connection) {
      return;
    }

    if (class_exists("Memcached")) {
      $this->mc = new Memcached();
      $this->mc->addServer($this->host, $this->port);
       $this->connection = true;
    } else {
      $this->connection = memcache_pconnect($this->host, $this->port);
    }

    if (! $this->connection) {
      $error = "Couldn't connect to memcache server";

      $this->client->getLogger()->error($error);
      throw new Google_Cache_Exception($error);
    }
  }
1069758
protected function memcache_init()
    {
        $this->mc_available = 0;

        // add all configured hosts to pool
        $pconnect       = $this->config->get('memcache_pconnect', true);
        $timeout        = $this->config->get('memcache_timeout', 1);
        $retry_interval = $this->config->get('memcache_retry_interval', 15);

        foreach ($this->config->get('memcache_hosts', array()) as $host) {
            if (substr($host, 0, 7) != 'unix://') {
                list($host, $port) = explode(':', $host);
                if (!$port) $port = 11211;
            }
            else {
                $port = 0;
            }

            $this->mc_available += intval($this->memcache->addServer(
                $host, $port, $pconnect, 1, $timeout, $retry_interval, false, array($this, 'memcache_failure')));
        }
    }
1307560
static synchronized void saveToCache(UnixUserGroupInformation ugi) {
    ugiCache.put(ugi.getUserName(), new CachedUgi(ugi, System
        .currentTimeMillis()));
  }
482026
protected function storeData()
    {
        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
            $this->currentObject->detach();

            $obj = serialize($this->currentObject);
            if (wincache_ucache_exists($this->cachePrefix.$this->currentObjectID.'.cache')) {
                if (!wincache_ucache_set($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) {
                    $this->__destruct();
                    throw new PHPExcel_Exception('Failed to store cell '.$this->currentObjectID.' in WinCache');
                }
            } else {
                if (!wincache_ucache_add($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) {
                    $this->__destruct();
                    throw new PHPExcel_Exception('Failed to store cell '.$this->currentObjectID.' in WinCache');
                }
            }
            $this->currentCellIsDirty = false;
        }

        $this->currentObjectID = $this->currentObject = null;
    }
1365134
def save(self, cachedir=None, cfgstr=None, verbose=VERBOSE, quiet=QUIET,
             ignore_keys=None):
        
        fpath = self.get_fpath(cachedir, cfgstr=cfgstr)
        if verbose:
            print('[Cachable] cache save: %r' % (basename(fpath),))

        if hasattr(self, '__getstate__'):
            statedict = self.__getstate__()
        else:
            statedict = self.__dict__

        if ignore_keys is None:
            save_dict = statedict
        else:
            save_dict = {key: val
                         for (key, val) in six.iteritems(statedict)
                         if key not in ignore_keys}

        util_io.save_data(fpath, save_dict)
        return fpath
1365244
def read(key, parameters = {})
      begin
        @memcached.get(normalize(key, parameters))
      rescue Memcached::NotFound, Memcached::Stored
        nil
      end
    end
980028
def cache(key, options = {}, &block) # :doc:
        if cache_configured?
          cache_store.fetch(ActiveSupport::Cache.expand_cache_key(key, :controller), options, &block)
        else
          yield
        end
      end
97108
private function initializeMemCached()
    {
        $this->memcached = new \Memcached();

        // support multiple hosts using semicolon to separate hosts
        $hosts = explode(';', $this->host);

        // different ports for each hosts the same way
        $ports = explode(';', $this->port);

        if (count($ports) < 1) {
            $ports = array_fill(0, count($hosts), self::DEFAULT_PORT);
        } elseif (count($ports) === 1) {
            // if we have just one port, use it for all hosts
            $usedPort = $ports[0];
            $ports    = array_fill(0, count($hosts), $usedPort);
        }

        foreach ($hosts as $i => $host) {
            if (!isset($ports[$i])) {
                /*
                 * if we have a difference between the count of hosts and
                 * the count of ports, use the default port to fill the gap
                 */
                $ports[$i] = self::DEFAULT_PORT;
            }

            $this->memcached->addServer($host, $ports[$i]);
        }
    }
310979
def _save_cache(self):
        """"""
        if not self._disable_cache:
            UTILS.save_cache(self._cache, self._cache_path)
802400
def write_to_cache(self, data, filename=''):
        '''  '''
        if not filename:
            filename = self.cache_path_cache
        json_data = json.dumps(data)
        with open(filename, 'w') as cache:
            cache.write(json_data)
        return True
633861
protected function _init() {
		$this->connection = $this->connection ?: new Memcached();
		$this->connection->addServers($this->_formatHostList($this->_config['host']));

		if ($this->_config['scope']) {
			$this->connection->setOption(Memcached::OPT_PREFIX_KEY, "{$this->_config['scope']}:");
		}
	}