Skip to content

Latest commit

 

History

History
576 lines (276 loc) · 7.88 KB

File metadata and controls

576 lines (276 loc) · 7.88 KB

CommonGateway\CoreBundle\Service\CacheService

Service to call external sources.

This service provides a guzzle wrapper to work with sources in the common gateway.

Methods

Name Description
__construct
aggregateQueries Creates an aggregation of results for possible query parameters
cacheEndpoint Put a single endpoint into the cache.
cacheObject Put a single object into the cache.
cacheShema Put a single schema into the cache.
cleanup Remove non-existing items from the cache.
countObjects Counts objects found with the given search/filter parameters.
countObjectsInCache Counts objects in a cache collection.
getEndpoint Get a single endpoint from the cache.
getEndpoints
getObject Get a single object from the cache.
handleResultPagination Adds pagination variables to an array with the results we found with searchObjects().
removeEndpoint Removes an endpoint from the cache.
removeObject Removes an object from the cache.
retrieveObjectsFromCache Retrieves objects from a cache collection.
searchObjects Searches the object store for objects containing the search string.
setPagination Decides the pagination values.
setStyle Set symfony style in order to output to the console.
warmup Throws all available objects into the cache.

CacheService::__construct

Description

 __construct (void)

Parameters

This function has no parameters.

Return Values

void


CacheService::aggregateQueries

Description

public aggregateQueries (array $filter, array $entities)

Creates an aggregation of results for possible query parameters

Parameters

  • (array) $filter : The filter to handle.
  • (array) $entities : The entities to search in.

Return Values

array

The resulting aggregation

Throws Exceptions

\Exception


CacheService::cacheEndpoint

Description

public cacheEndpoint (\Endpoint $endpoint)

Put a single endpoint into the cache.

Parameters

  • (\Endpoint) $endpoint

Return Values

\Endpoint


CacheService::cacheObject

Description

public cacheObject (\ObjectEntity $objectEntity)

Put a single object into the cache.

Parameters

  • (\ObjectEntity) $objectEntity

Return Values

\ObjectEntity


CacheService::cacheShema

Description

public cacheShema (\Entity $entity)

Put a single schema into the cache.

Parameters

  • (\Entity) $entity

Return Values

\Entity


CacheService::cleanup

Description

public cleanup (void)

Remove non-existing items from the cache.

Parameters

This function has no parameters.

Return Values

void

Nothing.


CacheService::countObjects

Description

public countObjects (string|null $search, array $filter, array $entities)

Counts objects found with the given search/filter parameters.

Parameters

  • (string|null) $search : a string to search for within the given context
  • (array) $filter : an array of dot.notation filters for which to search with
  • (array) $entities : schemas to limit te search to

Return Values

int

Throws Exceptions

\Exception


CacheService::countObjectsInCache

Description

public countObjectsInCache (array $filter)

Counts objects in a cache collection.

Parameters

  • (array) $filter : The mongoDB query to filter with.

Return Values

int

The amount of objects counted.


CacheService::getEndpoint

Description

public getEndpoint (\Uuid $identification)

Get a single endpoint from the cache.

Parameters

  • (\Uuid) $identification

Return Values

array|null


CacheService::getEndpoints

Description

 getEndpoints (void)

Parameters

This function has no parameters.

Return Values

void


CacheService::getObject

Description

public getObject (string $identification, string|null $schema)

Get a single object from the cache.

Parameters

  • (string) $identification : The ID of an Object.
  • (string|null) $schema : Only look for an object with this schema.

Return Values

array|null


CacheService::handleResultPagination

Description

public handleResultPagination (array $filter, array $results, int $total)

Adds pagination variables to an array with the results we found with searchObjects().

Parameters

  • (array) $filter
  • (array) $results
  • (int) $total

Return Values

array

the result with pagination.


CacheService::removeEndpoint

Description

public removeEndpoint (\Endpoint $endpoint)

Removes an endpoint from the cache.

Parameters

  • (\Endpoint) $endpoint

Return Values

void


CacheService::removeObject

Description

public removeObject (\ObjectEntity $objectEntity)

Removes an object from the cache.

Parameters

  • (\ObjectEntity) $objectEntity

Return Values

void


CacheService::retrieveObjectsFromCache

Description

public retrieveObjectsFromCache (array $filter, array|null $options, array $completeFilter)

Retrieves objects from a cache collection.

Parameters

  • (array) $filter : The mongoDB query to filter with.
  • (array|null) $options : Options like 'limit', 'skip' & 'sort' for the mongoDB->find query.
  • (array) $completeFilter : The completeFilter query, unchanged, as used on the request.

Return Values

array|int

$this->handleResultPagination() array with objects and pagination.


CacheService::searchObjects

Description

public searchObjects (string|null $search, array $filter, array $entities)

Searches the object store for objects containing the search string.

Parameters

  • (string|null) $search : a string to search for within the given context
  • (array) $filter : an array of dot.notation filters for which to search with
  • (array) $entities : schemas to limit te search to

Return Values

array

The objects found

Throws Exceptions

\Exception


CacheService::setPagination

Description

public setPagination (int $limit, int $start, array $filters)

Decides the pagination values.

Parameters

  • (int) $limit : The resulting limit
  • (int) $start : The resulting start value
  • (array) $filters : The filters

Return Values

array


CacheService::setStyle

Description

public setStyle (\SymfonyStyle $style)

Set symfony style in order to output to the console.

Parameters

  • (\SymfonyStyle) $style

Return Values

self


CacheService::warmup

Description

public warmup (array $config, string|null $bundleToCache)

Throws all available objects into the cache.

Parameters

  • (array) $config : An array which can contain the keys 'objects', 'schemas' and/or 'endpoints' to skip caching these specific objects. Can also contain the key removeOnly in order to only remove from cache.
  • (string|null) $bundleToCache : Bundle to cache objects from

Return Values

int