ntb/silverstripe-caching

Add ability to cache data objects, function results and arbitrary data.

This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.

Maintainers

Package info

github.com/notthatbad/silverstripe-caching

Homepage

Type:silverstripe-module

pkg:composer/ntb/silverstripe-caching

Statistics

Installs: 244

Dependents: 0

Suggesters: 0

Stars: 4

Open Issues: 1

0.1.9 2016-04-13 09:24 UTC

This package is auto-updated.

Last update: 2022-02-19 20:33:06 UTC


README

Build Status Latest Stable Version License

Add ability to cache data objects, function results and arbitrary data.

Usage

Like other extensions, you can add the ability to automatically cache objects with the following code to your YAML files.

Member:
  extensions:
    - CacheableExtension

It is recommended to specify rather another cache than Silverstripe's default cache, because it is configured to use the file cache backend. This could be much worse than the direct access to the database.

How it works

When requesting a data object with <ClassName>::byID or <ClassName>::byURL the cached data list implementation evaluates if the request object is flagged as cacheable. If this is true, the cache will be requested and only if nothing is found, the database is accessed. After fetching the object, every has_one dependency is fetched and the result is stored in a cache.

When a data object should be deleted or was modified, the cache entry will be cleared or alternated respectively.