Operation postMediaCacheSourcesConfig3

Adds the specified MediaCache Source to the list.

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

@return void
@throws ApiException on non-2xx response
506458
public function postMediaCacheSourcesConfig3($serverName, $body)
    {
        list($response) = $this->postMediaCacheSourcesConfig3WithHttpInfo($serverName, $body);
        return $response;
    }
1127984
public function postMediaAction($provider, Request $request) {
    	$pool = $this->get("sonata.media.pool");
        $manager = $this->get("sonata.media.manager.media");
    	$formFactory = $this->get('form.factory');

    	try {
    		$mediaProvider = $pool->getProvider($provider);
    	} catch (\RuntimeException $ex) {
    		throw new NotFoundHttpException($ex->getMessage(), $ex);
    	}
    	$medium = $manager->create();
    	$medium->setProviderName($provider);
    	$form = $formFactory->createNamed(null, 'sonata_media_api_form_media', $medium, array(
    			'provider_name'   => $mediaProvider->getName(),
//    			'csrf_protection' => false
    	));

    	$form->bind($request);

    	if ($form->isValid()) {
            try {
	    		$medium = $form->getData();
	    		$manager->save($medium);
            } catch (DBALException $e) {
                return $this->handleView(
                    View::create(array('errors'=>array($e->getMessage())), 400)
                );
            }
            return $this->handleView(
                View::create($this->formatMedia($medium), 200, array('Location'=>$this->generateUrl(
                    "_togu_media_rest_get_media",
                    array('id'=>$medium->getId()),
                    true
                )))->setSerializationContext($this->getSerializerContext(array('sonata_api_read')))
            );
    	} else {
            return $this->handleView(
                View::create(array('errors'=>$form->getErrors()), 400)
            );
        }
    }
64804
function onSingleEntityReceived( serverResponse ) {
			if( !serverResponse.data[ configuration.entityName ] ) {
				throw new Error( "The response from the server was not in the expected format. It should have a member named '" + configuration.entityName + "'." );
			}

			self.__entityCacheRaw = serverResponse.data;
			self.__onDataAvailable( serverResponse.data );
		}
913165
public function postMediaCacheSourcesConfig($serverName, $body)
    {
        list($response) = $this->postMediaCacheSourcesConfigWithHttpInfo($serverName, $body);
        return $response;
    }
1257634
final protected function addBodyToMultipartBuilder(Builder $builder, array $body, ?string $prefix = null): void
    {
        foreach ($body as $key => $value) {
            $name = $key;

            if (! \is_null($prefix)) {
                $name = "{$prefix}[{$key}]";
            }

            if (\is_array($value)) {
                $this->addBodyToMultipartBuilder($builder, $value, $name);
                continue;
            }

            $builder->addResource($name, $value, ['Content-Type' => 'text/plain']);
        }
    }
64744
public function onRequest($server, $serverSocket, $request, $response)
    {
        $swapHttpRequest = $this->app['request'];

        $httpRequest = $this->createHttpRequest($request);

        $respondent = $this->createRespondent($response);

        $httpRequest->attributes->add([
            'request'    => $request,
            'response'   => $response,
            'respondent' => $respondent
        ]);

        $httpResponse = $this->handleRequest($httpRequest, $respondent);

        $this->sendResponse($respondent, $httpResponse);

        $this->app->instance('request', $swapHttpRequest);
    }
1243278
def addResource(self, content, uri, headers):
        
        self.cache[uri] = CachedResource(content, headers)
1173273
public function getVHostConfig($serverName, $vhostName)
    {
        list($response) = $this->getVHostConfigWithHttpInfo($serverName, $vhostName);
        return $response;
    }
1362665
static function setContextCache( $contextName, $context )
    {
        if ( $context === null )
        {
            return;
        }
        if ( isset( $GLOBALS['eZTranslationCacheTable'][$contextName] ) )
        {
            eZDebug::writeWarning( "Translation cache for context '$contextName' already exists", __METHOD__ );
        }
        else
        {
            $GLOBALS['eZTranslationCacheTable'][$contextName] = array();
        }
        $GLOBALS['eZTranslationCacheTable'][$contextName]['root'] = $context;
        $GLOBALS['eZTranslationCacheTable'][$contextName]['info'] = array( 'context' => $contextName );
    }
525671
private function convertCacheAnnotationToCacheMetadata(
        Annotation\Cache $cacheAnnot,
        Mapping\ClassMetadata $metadata,
        $fieldName = null
    ) {
        $usage         = constant(sprintf('%s::%s', Mapping\CacheUsage::class, $cacheAnnot->usage));
        $baseRegion    = strtolower(str_replace('\\', '_', $metadata->getRootClassName()));
        $defaultRegion = $baseRegion . ($fieldName ? '__' . $fieldName : '');

        return new Mapping\CacheMetadata($usage, $cacheAnnot->region ?: $defaultRegion);
    }
350702
public function setTemplatefields($contentKey, $className)
    {
        if (!isset($this->contenttypes[$contentKey]['templatefields'])) {
            return;
        }

        $config = $this->contenttypes[$contentKey]['templatefields'];

        foreach ($config as &$template) {
            foreach ($template['fields'] as &$field) {
                $this->postProcessField($field);
            }
        }
        $mapping = [
            'fieldname' => 'templatefields',
            'type'      => 'json',
            'fieldtype' => $this->typemap['templatefields'],
            'config'    => $config,
        ];

        $this->metadata[$className]['fields']['templatefields'] = $mapping;
    }
493586
public function cacheResponseByTypo3Cache(
        $requestUri,
        array $requestGetData,
        array $apiMethodInfoMetadata,
        $responseData,
        $responseFormatClass,
        array $responseHeaders
    ) {
        $identifier = $this->buildIdentifier($requestUri, $requestGetData);
        $frontendCacheExpires = (integer) $apiMethodInfoMetadata['expires'];
        $typo3CacheExpires = (integer) $apiMethodInfoMetadata[self::API_METHOD_TYPO3CACHE_EXPIRES];
        $typo3CacheTags = explode(',', $apiMethodInfoMetadata[self::API_METHOD_TYPO3CACHE_TAGS]);

        $cacheData = array();
        $cacheData['requestUri'] = $requestUri;
        $cacheData['requestGetData'] = $requestGetData;
        $cacheData['responseData'] = $responseData;
        $cacheData['responseFormatClass'] = $responseFormatClass;
        $cacheData['responseHeaders'] = $responseHeaders;
        $cacheData['frontendCacheExpires'] = $frontendCacheExpires;

        $this->cache->set($identifier, $cacheData, $typo3CacheTags, $typo3CacheExpires);
    }
1261033
protected function pushCache(&$entity, $className) {
    if (!isset($entity->guid)) {
      return;
    }
    // Increment the entity access count.
    if (!isset($this->entityCount[$entity->guid])) {
      $this->entityCount[$entity->guid] = 0;
    }
    $this->entityCount[$entity->guid]++;
    // Check the threshold.
    if ($this->entityCount[$entity->guid] < $this->config['cache_threshold']) {
      return;
    }
    // Cache the entity.
    if ((array) $this->entityCache[$entity->guid] ===
        $this->entityCache[$entity->guid]) {
      $this->entityCache[$entity->guid][$className] = clone $entity;
    } else {
      while ($this->config['cache_limit']
          && count($this->entityCache) >= $this->config['cache_limit']) {
        // Find which entity has been accessed the least.
        asort($this->entityCount);
        foreach ($this->entityCount as $key => $val) {
          if (isset($this->entityCache[$key])) {
            break;
          }
        }
        // Remove it.
        if (isset($this->entityCache[$key])) {
          unset($this->entityCache[$key]);
        }
      }
      $this->entityCache[$entity->guid] = [$className => (clone $entity)];
    }
    $this->entityCache[$entity->guid][$className]->clearCache();
  }
651512
public void setServerCertificateMetadataList(java.util.Collection<ServerCertificateMetadata> serverCertificateMetadataList) {
        if (serverCertificateMetadataList == null) {
            this.serverCertificateMetadataList = null;
            return;
        }

        this.serverCertificateMetadataList = new com.amazonaws.internal.SdkInternalList<ServerCertificateMetadata>(serverCertificateMetadataList);
    }
1170256
public function putMonitoringConfig($serverName, $body)
    {
        list($response) = $this->putMonitoringConfigWithHttpInfo($serverName, $body);
        return $response;
    }
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);
        }
    }
433504
public function setBody($body)
    {
        if ($body !== false && (empty($body) || !is_array($body) || (count($body) % 2) !== 0)) {
            throw new InvalidResponseException($this->command, $body);
        }
        parent::setBody($body);
    }