ARK2/Cache

From ARK
Revision as of 15:27, 27 December 2016 by John Layt (talk | contribs) (Created page with "= Cache = Caching can greatly improve performance of ARK, especially for configuration and metadata, but also the data and database access. ARK provides a flexible caching sy...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Cache

Caching can greatly improve performance of ARK, especially for configuration and metadata, but also the data and database access. ARK provides a flexible caching system based on Doctrine Cache, Symphony Cache, and the PSR-6 Caching standard, and supporting filesystem, APCu, or Redis caches (others are possible but not officially supported).

By default, ARK will use APCu for caching if your server has APCu installed, otherwise a filesystem cache will be used. For high-volume sites and APIs, Redis is recommended using either Predis or PHPRedis. Redis can also be used as a Spatial cache to speed up spatial searches.

Configuration

If caching is not explicitly configured in the site.json file, then ARK will check if APCu is available, and if not will fall back to the filesystem. To fractionally improve performance, you can use site.json to explicitly set 'apcu' or 'file'.

If using Redis you need to explicitly set site.json to use 'redis' and the url of the Redis instance.

If Debug mode is enabled, the the cache is disabled.

Implementation

The Doctrine ORM requires the use of the Doctrine Cache component to cache database access, however it is not PSR-6 compliant and is primarily designed for database caching. The Symfony Cache component provides a PSR-6 implementation designed for a wider use case, and provides a bridge to the Doctrine Cache. ARK creates a Doctrine Cache object which is then passed to the Symfony Cache.