Stores a Project Descriptor in the Cache.
196108
public function save(ProjectDescriptor $projectDescriptor): void
    {
        $keys = [];
        $cache = $this->getCache();

        foreach ($cache as $key) {
            $keys[] = $key;
        }

        // store the settings for this Project Descriptor
        $cache->setItem(self::KEY_SETTINGS, $projectDescriptor->getSettings());

        // store cache items
        $usedKeys = [self::KEY_SETTINGS];
        foreach ($projectDescriptor->getFiles() as $file) {
            $key = self::FILE_PREFIX . md5($file->getPath());
            $usedKeys[] = $key;
            $cache->setItem($key, $file);
        }

        // remove any keys that are no longer used.
        $invalidatedKeys = array_diff($keys, $usedKeys);
        if ($invalidatedKeys) {
            $cache->removeItems($invalidatedKeys);
        }

        if ($cache instanceof OptimizableInterface) {
            $cache->optimize();
        }
    }
1220268
def _write_to_cache(self, expr, res):
        """"""
        res = dedent(res)
        super()._write_to_cache(expr, res)
1115511
def register(cache):
	'''  '''

	global caches
	name = cache().name
	if not caches.has_key(name):
		caches[name] = cache
1096428
public void store(K key, V loader) {
        // Clean up stale entries on every put.
        // This should avoid a slow memory leak of reference objects.
        cleanUpStaleEntries();
        map.put(key, new WeakKeyedRef<K, V>(key, loader, q));
    }
699000
@Override
	public void cacheResult(
		List<CPDefinitionLocalization> cpDefinitionLocalizations) {
		for (CPDefinitionLocalization cpDefinitionLocalization : cpDefinitionLocalizations) {
			if (entityCache.getResult(
						CPDefinitionLocalizationModelImpl.ENTITY_CACHE_ENABLED,
						CPDefinitionLocalizationImpl.class,
						cpDefinitionLocalization.getPrimaryKey()) == null) {
				cacheResult(cpDefinitionLocalization);
			}
			else {
				cpDefinitionLocalization.resetOriginalValues();
			}
		}
	}
387957
private List<Descriptor<T>> store() {
        if(type==null)
            return legacy;
        else
            return Jenkins.getInstance().<T,Descriptor<T>>getDescriptorList(type);
    }
953349
public function populate(ProjectDescriptor $projectDescriptor)
    {
        /** @var IteratorInterface $iteratorInterface */
        $iteratorInterface = $this->getCache()->getIterator();

        // load the settings object
        try {
            $settings = $this->getCache()->getItem(self::KEY_SETTINGS);
        } catch (\Exception $e) {
            $settings = $this->igBinaryCompatibleCacheClear(self::KEY_SETTINGS, $e);
        }

        if ($settings) {
            $projectDescriptor->setSettings($settings);
        }

        // FIXME: Workaround for: https://github.com/zendframework/zf2/pull/4154
        if ($iteratorInterface->valid()) {
            foreach ($this->getCache() as $key) {
                try {
                    $item = $this->getCache()->getItem($key);
                } catch (\Exception $e) {
                    $this->igBinaryCompatibleCacheClear($key, $e);
                }

                if ($item instanceof FileDescriptor) {
                    $projectDescriptor->getFiles()->set($item->getPath(), $item);
                }
            }
        }
    }
370675
private void saveToBundleDescriptor() throws CmsException {

        if (null != m_descFile) {
            m_removeDescriptorOnCancel = false;
            updateBundleDescriptorContent();
            m_descFile.getFile().setContents(m_descContent.marshal());
            m_cms.writeFile(m_descFile.getFile());
        }
    }
1300315
private static void initCaches() {

        if (m_cacheTemporary == null) {
            m_cacheTemporary = CmsMemoryMonitor.createLRUCacheMap(1024);

            m_cachePermanent = new ConcurrentHashMap<String, byte[]>(32);

            m_cacheContentDefinitions = CmsMemoryMonitor.createLRUCacheMap(CONTENT_DEFINITION_CACHE_SIZE);
        }
        if (OpenCms.getRunLevel() > OpenCms.RUNLEVEL_1_CORE_OBJECT) {
            if ((OpenCms.getMemoryMonitor() != null)
                && !OpenCms.getMemoryMonitor().isMonitoring(CmsXmlEntityResolver.class.getName() + ".cacheTemporary")) {
                // reinitialize the caches after the memory monitor is set up
                Map<String, byte[]> cacheTemporary = CmsMemoryMonitor.createLRUCacheMap(128);
                cacheTemporary.putAll(m_cacheTemporary);
                m_cacheTemporary = cacheTemporary;
                OpenCms.getMemoryMonitor().register(
                    CmsXmlEntityResolver.class.getName() + ".cacheTemporary",
                    cacheTemporary);

                Map<String, byte[]> cachePermanent = new ConcurrentHashMap<String, byte[]>(32);
                cachePermanent.putAll(m_cachePermanent);
                m_cachePermanent = cachePermanent;
                OpenCms.getMemoryMonitor().register(
                    CmsXmlEntityResolver.class.getName() + ".cachePermanent",
                    cachePermanent);

                Map<String, CmsXmlContentDefinition> cacheContentDefinitions = CmsMemoryMonitor.createLRUCacheMap(
                    CONTENT_DEFINITION_CACHE_SIZE);
                cacheContentDefinitions.putAll(m_cacheContentDefinitions);
                m_cacheContentDefinitions = cacheContentDefinitions;
                OpenCms.getMemoryMonitor().register(
                    CmsXmlEntityResolver.class.getName() + ".cacheContentDefinitions",
                    cacheContentDefinitions);
            }
        }
    }
219914
private void storeFileHashCache(Properties props) {
        File cacheFile = new File(this.targetDirectory, CACHE_PROPERTIES_FILENAME);
        try (OutputStream out = new BufferedOutputStream(new FileOutputStream(cacheFile))) {
            props.store(out, null);
        } catch (IOException e) {
            getLog().warn("Cannot store file hash cache properties file", e);
        }
    }
729730
protected static function BuildCache() {
      self::CalculateData(self::$Categories);
      self::JoinRecentPosts(self::$Categories);
      Gdn::Cache()->Store(self::CACHE_KEY, self::$Categories, array(Gdn_Cache::FEATURE_EXPIRY => 600));
   }
150897
public <C extends AbstractComponentController<?, ?, ?>> void storeInCache(C controller) {
    ControllerFactory.get()
                     .storeInCache(controller);
    controller.setCached(true);
  }
529885
def _store_cached_source_variable(self, source_id, name, value):
        
        source_state = self._source_state.setdefault(source_id, {})
        name = name.lower()
        source_state[name] = value
        logger.debug("Source Cache store S[%d].%s = %s",
                     source_id, name, value)
        for callback in self._source_callbacks:
            callback(source_id, name, value)
462399
public void cacheDescriptorValue(IAtom atom, IAtomContainer container, IDescriptorResult value) {
        if (cachedDescriptorValues == null) {
            cachedDescriptorValues = new HashMap();
            cachedDescriptorValues.put(PREVIOUS_ATOMCONTAINER, container);
        } else if (cachedDescriptorValues.get(PREVIOUS_ATOMCONTAINER) != container) {
            cachedDescriptorValues.clear();
            cachedDescriptorValues.put(PREVIOUS_ATOMCONTAINER, container);
        }
        cachedDescriptorValues.put(atom, value);
    }
55861
public void cacheDescriptorValue(IBond bond, IAtomContainer container, IDescriptorResult doubleResult) {
        if (cachedDescriptorValues == null) {
            cachedDescriptorValues = new HashMap();
            cachedDescriptorValues.put(PREVIOUS_ATOMCONTAINER, container);
        } else if (cachedDescriptorValues.get(PREVIOUS_ATOMCONTAINER) != container) {
            cachedDescriptorValues.clear();
            cachedDescriptorValues.put(PREVIOUS_ATOMCONTAINER, container);
        }
        cachedDescriptorValues.put(bond, doubleResult);
    }
947658
def create_project(self, name, description):
        
        self._cache_project_list_once()
        if name in [project.name for project in self.projects]:
            raise DuplicateNameError("There is already a project named {}".format(name))
        self.client.create_project(name, description)
        self.clear_project_cache()
        return name
524754
def assure_cache(project_path=None):
    

    project_path = path(project_path, ISDIR)
    cache_path = os.path.join(project_path, CACHE_NAME)

    if not os.path.isdir(cache_path):
        os.mkdir(cache_path)