Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 910 Bytes

caching.md

File metadata and controls

28 lines (21 loc) · 910 Bytes

Caching

By default, Typhoon Reflection uses in-memory LRU cache which should be enough for the majority of use cases.

However, if you need persistent cache, you can use any PSR-16 implementation. We highly recommend Typhoon OPcache. It stores values as opcacheable php files.

use Typhoon\Reflection\TyphoonReflector;
use Typhoon\OPcache\TyphoonOPcache;

$reflector = TyphoonReflector::build(
    cache: new TyphoonOPcache('path/to/cache/dir'),
);

To detect file changes during development, decorate your cache with FreshCache.

use Typhoon\Reflection\TyphoonReflector;
use Typhoon\Reflection\Cache\FreshCache;
use Typhoon\OPcache\TyphoonOPcache;

$reflector = TyphoonReflector::build(
    cache: new FreshCache(new TyphoonOPcache('path/to/cache/dir')),
);