Skip to content

9.1.0

Compare
Choose a tag to compare
@binaryk binaryk released this 05 Jun 18:14
· 15 commits to 9.x since this release

Added

  • Ability to cache single policy #605

Restify allows individual caching at the policy level with specific configurations. To enable this, a contract Cacheable must be implemented at the policy level, which enforces the use of the cache() method.

class PostPolicy implements Cacheable
{
    public function cache(): ?CarbonInterface
    {
        return now()->addMinutes();
    }

The cache method is expected to return a CarbonInterface or null. If null is returned, the current policy will NOT cached.