Skip to content

marko-php/marko-cache-array

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

marko/cache-array

In-memory cache driver — stores data for the duration of a single request with zero I/O overhead.

Installation

composer require marko/cache-array

Quick Example

use Marko\Cache\Contracts\CacheInterface;

class ExpensiveService
{
    public function __construct(
        private CacheInterface $cache,
    ) {}

    public function compute(string $key): array
    {
        if ($this->cache->has($key)) {
            return $this->cache->get($key);
        }

        $result = $this->doExpensiveWork($key);
        $this->cache->set($key, $result);

        return $result;
    }
}

Documentation

Full usage, API reference, and examples: marko/cache-array

About

[READ-ONLY] In-memory array cache driver for Marko Framework. Issues and PRs at https://github.com/marko-php/marko

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages