Big block of caching functionality.
542426
public function cachedPermissions()
    {
        $rolePrimaryKey = $this->primaryKey;
        $cacheKey = 'entrust_permissions_for_role_'.$this->$rolePrimaryKey;

        return Cache::tags(Config::get('entrust.permission_role_table'))->remember($cacheKey, Config::get('cache.ttl'), function () {
            return $this->perms()->get();
        });
    }
144011
private void putInCache(MembershipType mt)
   {
      cache.put(mt.getName(), mt, CacheType.MEMBERSHIPTYPE);
   }
803079
def rr_cache(maxsize=128, choice=random.choice, typed=False):
    
    if maxsize is None:
        return _cache(_UnboundCache(), typed)
    else:
        return _cache(RRCache(maxsize, choice), typed)
687007
def FlushCache(self):
    """"""
    self._cache = b''
    self._cache_start_offset = None
    self._cache_end_offset = None
    self._ResetDecompressorState()
196974
def _fill_cache(self, namespace):
        """"""

        modules = self._findPluginModules(namespace)

        self._cache = list(modules)
416521
def cached(fn, size=32):
    ''' '''
    assert callable(fn)
    assert isinstance(size, int)
    return overload(fn)(lru_cache(size, typed=True)(fn))
123095
function memoize( f ) {
   const cache = {};
   return key => {
      let value = cache[ key ];
      if( value === undefined ) {
         value = f( key );
         cache[ key ] = value;
      }
      return value;
   };
}
544353
def collect(self):
        """"""
        for func in self._caches:
            cache = {}
            for key in self._caches[func]:
                if (time.time() - self._caches[func][key][1]) < self._timeouts[func]:
                    cache[key] = self._caches[func][key]
            self._caches[func] = cache
822653
static function cleanupCacheDir( $cacheDir )
    {
        $ini = eZINI::instance();
        if ( $ini->variable( 'TemplateSettings', 'DelayedCacheBlockCleanup' ) === 'enabled' )
        {
            eZSubtreeCache::renameDir( $cacheDir );
        }
        else
        {
            eZSubtreeCache::removeExpiryCacheFromDisk( $cacheDir );
        }
    }
1106984
def enable_caching(self):
        ""
        self.caching_enabled = True
        for c in self.values():
            c.enable_cacher()
1023758
public void cache(K name, V data) {

		if ( data == null){
			return;
		}
		if ( serializedCache != null){


			logger.debug("Caching {}  {}", name, data);

			serializedCache.put(name,data);


			// every 1000 objects we are writing to disk
			if ( serializedCache.keySet().size() % 1000 == 0 ) {

				flushCache();

			}

		}


	}
883911
def tryload_cache(dpath, fname, cfgstr, verbose=None):
    
    try:
        return load_cache(dpath, fname, cfgstr, verbose=verbose)
    except IOError:
        return None
269826
private synchronized void stopCache()
    {
        Object[] pTables = m_setTableCacheList.toArray();
        for (Object objTable : pTables)
        {
            PTable pTable = (PTable)objTable;
            pTable.removePTableOwner(this, true);
            m_setTableCacheList.remove(pTable);
        }
        m_setTableCacheList.removeAll(m_setTableCacheList);
    }
1293101
function cache(db, defaults, callback) {
    var cached = new EventEmitter()
        , args = parse(db, defaults, callback) // Arguments ~_~

    callback = args[2]
    defaults = extend({}, defaultOptions, args[1])
    db = args[0]

    var cache = LRUCache(defaults)
        , readStream = LevelReadStream(db, cache, args[1])

    extend(cached, {
        put: put
        , del: del
        , get: get
        , batch: batch
        , isOpen: value(true)
        , isClosed: value(false)
        , open: open
        , close: close
        , writeStream: LevelWriteStream(cached)
        , readStream: readStream
        , keyStream: keyStream
        , valueStream: valueStream
    })

    process.nextTick(function () {
        callback && callback(cached)
        cached.emit("ready")
    })

    return cached

    function put(key, value, options, callback) {
        var _callback = cb(options, callback)
            , _options = getOptions(defaults, options)
            , _key = toKeyBuffer(key, _options)

        cache.set(_key, value)

        if (db) {
            db.put(key, value, _options, _callback || emit)
        }

        cached.emit("put", key, value)
        _callback && _callback(null)
    }

    function del(key, options, callback) {
        var _callback = cb(options, callback)
            , _options = getOptions(defaults, options)
            , _key = toKeyBuffer(key, _options)

        cache.del(_key)

        if (db) {
            db.del(key, _options, _callback || emit)
        }

        cached.emit("del", key)
        _callback && _callback(null)
    }

    function get(key, options, callback) {
        var _callback = cb(options, callback)
            , _options = getOptions(defaults, options)
            , _key = toKeyBuffer(key, _options)
            , value = cache.get(_key)

        if (_callback && value !== undefined &&
            _options.cache !== false
        ) {
            return _callback(null, value)
        }

        if (db && _callback) {
            return db.get(key, _options, _callback || emit)
        }

        return value
    }

    function batch(arr, options, callback) {
        var _callback = cb(options, callback)
            , _options = getOptions(defaults, options)

        arr.forEach(function (item) {
            var key = toKeyBuffer(item.key, _options)
                , value = item.value
                , type = item.type

            if (type === "put") {
                cache.set(key, value)
            } else if (type === "del") {
                cache.del(key)
            }
        })

        if (db) {
            db.batch(arr, _options, _callback || emit)
        }

        cached.emit("batch", arr)
        _callback && _callback(null)
    }

    function valueStream(options) {
        return readStream(extend(options || {}, {
            keys: false
            , values: true
        }))
    }

    function keyStream(options) {
        return readStream(extend(options || {}, {
            keys: true
            , values: false
        }))
    }

    function open(callback) {
        callback && callback()
    }

    function close(callback) {
        cache.reset()
        cached.emit("closed")
        callback && callback()
    }

    function emit(err) {
        if (err) {
            return cached.emit("error", err)
        }
    }
}
318722
def nocache(func):
    """"""

    def new_func(*args, **kwargs):
        """No cache Wrapper."""
        resp = make_response(func(*args, **kwargs))
        resp.cache_control.no_cache = True
        return resp

    return update_wrapper(new_func, func)
42269
private void recalculateSizeReadCaches() {
		final int maxCacheNodes = (maxCacheSizeInBytes / blockSize);
		readCacheInternal = Math.max((int) (maxCacheNodes * .05f), 37);
		readCacheLeaf = Math.max((int) (maxCacheNodes * .95f), 37);
	}
1312445
function skipCache (options) {
  return options.noCache || options.plugin.length || options.partial.length || options.helper.length
}