Operation postMediaCacheStoresConfig3

Adds the specified MediaCache Store to the list.

@param string $serverName Reserved for future use (required)
@param MediaCacheStoreConfig $body  (required)

@return void
@throws ApiException on non-2xx response
778342
public function postMediaCacheStoresConfig3($serverName, $body)
    {
        list($response) = $this->postMediaCacheStoresConfig3WithHttpInfo($serverName, $body);
        return $response;
    }
536708
public function create($storeId, $containerName)
    {
        $scopeCode = $this->getScopeCode($storeId, $containerName);

        if (!isset($this->cachedConfig[$scopeCode])) {
            $instanceConfiguration          = $this->loadConfiguration($scopeCode);
            $this->cachedConfig[$scopeCode] = $this->objectManager->create($this->instanceName, $instanceConfiguration);
        }

        return $this->cachedConfig[$scopeCode];
    }
848681
function afterEntityStored( returnResult, serverResponse ) {
		var self = this;

		// Writing an entity to the backend will usually invoke an update event to be
		// broadcast over websockets, where we would also retrieve the updated record.
		// We still put the updated record we receive here into the cache to ensure early consistency, if that is requested.
		if( !returnResult && !self.forceEarlyCacheUpdate ) {
			return;
		}

		if( serverResponse.data[ configuration.entityName ] ) {
			var rawEntity = serverResponse.data[ configuration.entityName ];
			// If early cache updates are forced, put the return entity into the cache.
			if( self.forceEarlyCacheUpdate ) {
				var newEntity = self.deserializer( rawEntity );
				self.__updateCacheWithEntity( newEntity );

				if( returnResult ) {
					return newEntity;
				}
			}
			if( returnResult ) {
				return rawEntity;
			}
		}
	}
781342
public function put($filename, $content)
    {
        // Merge existing content to new content
        if (file_exists($this->cacheDir . $filename) && file_get_contents($this->cacheDir . $filename) != '') {
            $cachedContent = $this->get($filename);
            $content       = array_merge($content, $cachedContent);
        }
        $this->files->put($this->cacheDir . $filename, json_encode($content));
    }
913165
public function postMediaCacheSourcesConfig($serverName, $body)
    {
        list($response) = $this->postMediaCacheSourcesConfigWithHttpInfo($serverName, $body);
        return $response;
    }
1127966
public function storeResponse(Response $response, $method, $url, array $data = [], array $headers = [], $basicAuthCredentials = '', $minutes = 30)
    {
        $signature = $this->signature->generate($method, $url, $data, $headers, $basicAuthCredentials);

        $this->cacheManager->store($signature, $response, $minutes);
    }
1306689
public function addStore($storeName, $builderName, array $options = array())
    {
        $this->storeRegistryBuilder->addStore($storeName, $builderName, $options);
    }
980692
public function postUsersConfig($serverName, $body)
    {
        list($response) = $this->postUsersConfigWithHttpInfo($serverName, $body);
        return $response;
    }
1252556
public function mediaAction(Request $request)
    {
        $fileId = $request->get('file_id');
        $fileVersion = $request->get('file_version');
        $templateKey = $request->get('template_key');

        $cacheManager = $this->get('phlexible_media_cache.cache_manager');
        $storageManager = $this->get('phlexible_media_cache.storage_manager');
        $templateManager = $this->get('phlexible_media_template.template_manager');
        $mediaTypeManager = $this->get('phlexible_media_type.media_type_manager');
        $delegateService = $this->get('phlexible_media_cache.image_delegate.service');
        $volumeManager = $this->get('phlexible_media_manager.volume_manager');

        try {
            $cacheItem = $cacheManager->findByTemplateAndFile($templateKey, $fileId, $fileVersion);
        } catch (\Exception $e) {
            $cacheItem = null;
        }

        $template = $templateManager->find($templateKey);

        if ($cacheItem) {
            if ($cacheItem->getCacheStatus() === CacheItem::STATUS_WAITING) {
                $cacheItem = $this->doCache($fileId, $fileVersion, $template, $cacheItem);
            } elseif ($cacheItem->getCacheStatus() === CacheItem::STATUS_MISSING) {
                $cacheItem = $this->doCache($fileId, $fileVersion, $template, $cacheItem);
            }

            if ($cacheItem && $cacheItem->getCacheStatus() === CacheItem::STATUS_OK) {
                $storageKey = $template->getStorage();
                $storage = $storageManager->get($storageKey);
                $filePath = $storage->getLocalPath($cacheItem);

                if (!file_exists($filePath)) {
                    $filePath = null;
                    $cacheItem = $this->doCache($fileId, $fileVersion, $template, $cacheItem);

                    if ($cacheItem && $cacheItem->getCacheStatus() === CacheItem::STATUS_OK) {
                        $storageKey = $template->getStorage();
                        $storage = $storageManager->get($storageKey);
                        $filePath = $storage->getLocalPath($cacheItem);
                    }
                }
            }

            if ($cacheItem) {
                $mimeType = $cacheItem->getMimeType();
            }
        } else {
            $cacheItem = $this->doCache($fileId, $fileVersion, $template);

            if ($cacheItem) {
                if ($cacheItem->getCacheStatus() === CacheItem::STATUS_OK) {
                    $storageKey = $template->getStorage();
                    $storage = $storageManager->get($storageKey);
                    $filePath = $storage->getLocalPath($cacheItem);
                }
                $mimeType = $cacheItem->getMimeType();
            }
        }

        if (empty($filePath)) {
            if (!$template instanceof ImageTemplate) {
                return new Response('Not found', 404);
            }

            $file = $volumeManager->getByFileId($fileId)->findFile($fileId);
            $mediaType = $mediaTypeManager->find(strtolower($file->getMediaType()));
            $filePath = $delegateService->getClean($template, $mediaType, true);
            $mimeType = 'image/gif';
        }

        $response = new BinaryFileResponse($filePath, 200, array('Content-Type' => $mimeType));

        return $response;
    }
79568
protected static function initSessionStorage(string $dbName) : void
    {
        if (!isset($_SESSION['databases']) || !\is_array($_SESSION['databases'])) {
            $_SESSION['databases'] = [];
        }

        if (!isset($_SESSION['databases'][$dbName]) || !\is_array($_SESSION['databases'][$dbName])) {
            $_SESSION['databases'][$dbName] = ['tables' => []];
        }
    }
1118465
public function putMediaCacheStoreConfig($serverName, $body)
    {
        list($response) = $this->putMediaCacheStoreConfigWithHttpInfo($serverName, $body);
        return $response;
    }
380195
public function put(string $body, string $version = HttpVersion::HTTP_1_1): HttpResponse
    {
        return HttpRequest::create($this->httpUri, $this->headers)
                ->put($body, $this->timeout, $version);
    }
789857
protected void cacheAdd(IPermissionSet ps) throws AuthorizationException {
        try {
            EntityCachingService.getEntityCachingService().add(ps);
        } catch (CachingException ce) {
            throw new AuthorizationException(
                    "Problem adding permissions for " + ps + " to cache", ce);
        }
    }
506458
public function postMediaCacheSourcesConfig3($serverName, $body)
    {
        list($response) = $this->postMediaCacheSourcesConfig3WithHttpInfo($serverName, $body);
        return $response;
    }
1266932
protected function _setServiceCache($serviceCache)
    {
        if ($serviceCache !== null && !($serviceCache instanceof ContainerInterface)) {
            throw $this->_createInvalidArgumentException($this->__('Invalid cache'), null, null, $serviceCache);
        }

        $this->serviceCache = $serviceCache;
    }
753589
protected function addCacheDirectory(ContainerInterface $container, SerializerBuilder $builder): void
    {
        $config = $container->get('config');
        $libraryConfig = $config[ConfigKey::PROJECT][ConfigKey::API_CLIENT] ?? [];
        $cacheDir = (string) ($libraryConfig[ConfigKey::CACHE_DIR] ?? '');

        if ($cacheDir !== '') {
            $builder->setCacheDir($cacheDir);
        }
    }
34828
public function set(Cache $cache, $userName)
    {
        if (!is_writable(dirname($this->getCacheFile($userName)))) {
            throw new CacheException('Cache folder is not writable');
        }

        $data   = serialize($cache);
        $handle = fopen($this->getCacheFile($userName), 'w+');

        fwrite($handle, $data);
        fclose($handle);
    }