Skip to content

Latest commit

 

History

History
57 lines (38 loc) · 1.42 KB

cache.md

File metadata and controls

57 lines (38 loc) · 1.42 KB
notice title description image permalink source layout
This file is imported and can be edited at https://github.com/amphp/cache/blob/2.x/README.md
Cache Data in Concurrent PHP Applications
Learn how to cache data to serve requests faster in a concurrency safe way.
undraw/undraw_memory_storage.svg
/cache
docs

AMPHP is a collection of event-driven libraries for PHP designed with fibers and concurrency in mind. amphp/cache specifically provides a cache interface and multiple implementations of it.

Latest Release MIT License

Installation

This package can be installed as a Composer dependency.

composer require amphp/cache

Usage

AtomicCache

Cache

<?php

namespace Amp\Cache;

interface Cache
{
    public function get(string $key): mixed;

    public function set(string $key, mixed $value, int $ttl = null): void;

    public function delete(string $key): ?bool;
}

LocalCache

NullCache

Cache implementation that just ignores all operations and always resolves to null.

PrefixCache

SerializedCache

StringCache

StringCacheAdapter