store annotations in the cache

@param  \stubbles\reflect\annotation\Annotations  $annotations
428127
public static function put(Annotations $annotations)
    {
        self::$annotations[$annotations->target()]  = serialize($annotations);
        self::$unserialized[$annotations->target()] = $annotations;
        self::$cacheChanged = true;
    }
57153
public function getMethods(array $annotations = []): array
    {
        $methods = array_filter($this->methods, function (ParsedFunction $method) use ($annotations): bool {
            foreach ($annotations as $a => $v) {
                foreach (explode(',', $v) as $subValue) {
                    if ($method->hasAnnotation($a, $subValue)) {
                        return true;
                    }
                }
            }

            return false;
        });

        return $methods ?: $this->methods;
    }
953140
public function addFilesToRegistry($filePaths)
    {
        collect((array) $filePaths)->each(function ($filePath) {
            if (file_exists($filePath)) {
                AnnotationRegistry::registerFile($filePath);
            }
        });

        return $this;
    }
622689
public static function deleteBatch(...$keys)
    {
        $memoryTableAnnotation = ModelManager::getAnnotation(static::class, MemoryTable::class);
        if(null === $memoryTableAnnotation)
        {
            return null;
        }
        if(isset($keys[0]) && is_array($keys[0]))
        {
            $keys = $keys[0];
        }
        foreach($keys as $key)
        {
            MemoryTableManager::del($memoryTableAnnotation->name, $key);
        }
    }
1302251
protected function flushCache(array $invalidates): void
    {
        if (\count($invalidates) > 0) {
            if ($this->cache instanceof AdapterInterface && null !== $this->context) {
                $this->cache->clearByPrefixes($invalidates);
            } elseif (null !== $this->cache) {
                $this->cache->clear();
            }

            if ($this->sim instanceof CacheSecurityIdentityManagerInterface) {
                $this->sim->invalidateCache();
            }
        }
    }
481813
protected function storeCollection($entities)
    {
        $this->adapter->beginTransaction();

        foreach ($entities as $entity) {
            $this->storeEntity($entity);
        }

        $this->adapter->commit();

        return $entities;
    }
427615
public function setPersistent($persists)
    {
        if (is_string($persists)) {
            $persists = $persists === 'true' ? true : false;
        }
        $this->persistent = $persists;
    }
922966
function store( $fieldFilters = null )
    {
        $db = eZDB::instance();

        $db->begin();
        parent::store( $fieldFilters );
        $this->updateAndStoreModified();
        $db->commit();
    }
251507
def storeTopAnnotations(self, service_name, annotations):
    
    self.send_storeTopAnnotations(service_name, annotations)
    self.recv_storeTopAnnotations()
444611
private function filterAnnotations(array $annotations): array
    {
        $annotations = \array_filter($annotations, function ($annotation) {
            $ref = new \ReflectionObject($annotation);

            return 0 === \mb_strpos($ref->getNamespaceName(), 'TSantos\Serializer');
        });

        return $annotations;
    }
422129
final protected function nonNullIfHasDefault(AbstractAnnotation $annotation): void
    {
        $type = $annotation->getTypeInstance();
        if ($type instanceof NonNull && $annotation->hasDefaultValue()) {
            $annotation->setTypeInstance($type->getWrappedType());
        }
    }
86969
protected function storeConsoleLogsFor($browsers)
    {
        $browsers->each(function ($browser, $key) {
            $name = str_replace('\\', '_', get_class($this)).'_'.$this->getName(false);

            $browser->storeConsoleLog($name.'-'.$key);
        });
    }
170117
public function getAnnotations(\Reflector $Reflection)
    {
        $doc = $Reflection->getDocComment();
        if ($this->cache) {
            $key = $this->cache->getKey($doc);
            $ast = $this->cache->get($key);
            if (! $ast) {
                $ast = $this->parser->parse($doc);
                $this->cache->set($key, $ast);
            }
        } else {
            $ast = $this->parser->parse($doc);
        }

        return new AnnotationsBag($ast);
    }
1270843
protected function scanAnnotations()
    {
        $scans = $this->classesToScan();

        if (empty($scans)) {
            return;
        }

        $scanner = $this->getAnnotationScanner();

        $scanner->setClassesToScan($scans);

        $scanner->scan();
    }
1183379
public static function unserializeAnnotations($annotations)
    {
        $returnValue = array();

        
        $matches = array();
        $encoding = self::getApplicationHelper()->getDefaultEncoding();
        
        if (preg_match_all('/(#[\.\:,\|]{0,1}\s+(?:[^\\n]*))/', $annotations, $matches) !== false){
            if (isset($matches[1]) && count($matches[1]) > 0){
                foreach ($matches[1] as $match){
                    $match = trim($match);
                    $matchLen = mb_strlen($match, $encoding);
                    $annotationId = null;
                    $annotationValue = null;
                    
                    switch (mb_substr($match, 1, 1, $encoding)){
                        case "\t":
                        case ' ':
                            // Translator comment.
                            $annotationId = tao_helpers_translation_POTranslationUnit::TRANSLATOR_COMMENTS;
                            $annotationValue = mb_substr($match, 2, $matchLen - 2, $encoding);
                        break;
                        
                        case '.':
                            $annotationId = tao_helpers_translation_POTranslationUnit::EXTRACTED_COMMENTS;
                            $annotationValue = mb_substr($match, 3, $matchLen - 3, $encoding);
                        break;
                        
                        case ':':
                            $annotationId = tao_helpers_translation_POTranslationUnit::REFERENCE;
                            $annotationValue = mb_substr($match, 3, $matchLen - 3, $encoding);
                        break;
                        
                        case ',':
                            $annotationId = tao_helpers_translation_POTranslationUnit::FLAGS;
                            $annotationValue = mb_substr($match, 3, $matchLen - 3, $encoding);
                        break;
                        
                        case '|':
                            if (($pos = mb_strpos($match, 'msgid_plural', 0, $encoding)) !== false){
                                $pos += mb_strlen('msgid_plural', $encoding) + 1;
                                $annotationId = tao_helpers_translation_POTranslationUnit::PREVIOUS_MSGID_PLURAL;
                                $annotationValue = mb_substr($match, $pos, $matchLen - $pos, $encoding);
                            }
                            else if(($pos = mb_strpos($match, 'msgid', 0, $encoding)) !== false){
                                $pos += mb_strlen('msgid', $encoding) + 1;
                                $annotationId = tao_helpers_translation_POTranslationUnit::PREVIOUS_MSGID;
                                $annotationValue = mb_substr($match, $pos, $matchLen - $pos, $encoding);
                            }
                            else if(($pos = mb_strpos($match, 'msgctxt', 0, $encoding)) !== false){
                                $pos += mb_strlen('msgctxt', $encoding) + 1;
                                $annotationId = tao_helpers_translation_POTranslationUnit::PREVIOUS_MSGCTXT;
                                $annotationValue = mb_substr($match, $pos, $matchLen - $pos, $encoding);
                            }
                        break;
                    }
                    
                    if ($annotationId != null && $annotationValue != null){
                        if (!isset($returnValue[$annotationId])){
                            $returnValue[$annotationId] = $annotationValue;
                        }
                        else{
                            $returnValue[$annotationId] .= "\n${annotationValue}";
                        }
                    }
                }
            }
            
        }
        else{
            throw new tao_helpers_translation_TranslationException("An error occured while unserializing annotations '${annotations}'.");
        }
        

        return (array) $returnValue;
    }
884330
protected function cacheResults(array $results)
    {
        $mapper = $this->mapper;

        // When hydrating EmbeddedValue object, they'll likely won't
        // have a primary key set.
        if ($mapper->getEntityMap()->getKeyName() !== null) {
            $mapper->getEntityCache()->add($results);
        }
    }
159534
protected function handleLinks(RelationshipAnnotation $annotation, Relationship $relationship)
    {
        foreach ($annotation->links as $linkAnnotation)
        {
            $link = $this->createLink($linkAnnotation);

            $relationship->addLink($link);
        }
    }