Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/laminas/laminas-cache
Caching implementation with a variety of storage options, as well as codified caching strategies for callbacks, classes, and output
https://github.com/laminas/laminas-cache
cache psr-16 psr-6
Last synced: 2 days ago
JSON representation
Caching implementation with a variety of storage options, as well as codified caching strategies for callbacks, classes, and output
- Host: GitHub
- URL: https://github.com/laminas/laminas-cache
- Owner: laminas
- License: bsd-3-clause
- Created: 2019-12-31T21:12:03.000Z (almost 5 years ago)
- Default Branch: 4.1.x
- Last Pushed: 2024-11-05T06:06:56.000Z (6 days ago)
- Last Synced: 2024-11-05T07:18:42.668Z (6 days ago)
- Topics: cache, psr-16, psr-6
- Language: PHP
- Homepage: https://docs.laminas.dev/laminas-cache/
- Size: 6.37 MB
- Stars: 99
- Watchers: 21
- Forks: 52
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-php - Laminas Cache - Another caching library. (Table of Contents / Caching and Locking)
- awesome-php-cn - Laminas Cache - 另一个缓存库. (目录 / 缓存和锁定 Caching and Locking)
- awesome-projects - Laminas Cache - Another caching library. (PHP / Caching and Locking)
- awesome-php - Laminas Cache - Another caching library. (Table of Contents / Caching and Locking)
README
# laminas-cache
[![Build Status](https://github.com/laminas/laminas-cache/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/laminas/laminas-cache/actions/workflows/continuous-integration.yml)
> ## 🇷🇺 Русским гражданам
>
> Мы, участники Laminas, родились и живем в разных странах. У многих из нас есть друзья, родственники и коллеги как в России, так и в Украине. Некоторые из нас родились в России. Некоторые из нас живут в России. У некоторых бабушки и дедушки сражались с фашистами во Второй мировой войне. Здесь никто не поддерживает фашизм.
>
> У одного из нас есть украинская родственница, которая спаслась из дома вместе с сыном. Поезд задержался из-за бомбежки на дороге впереди. У нас есть друзья, которые прячутся в бомбоубежищах. Мы с тревогой ждем весточки от них после воздушных налетов, которые беспорядочно наносят удары и попадают по больницам, школам, детским садам и домам. Мы не берем это из каких-либо СМИ. Мы наблюдаем это напрямую.
>
> Вы доверяете нам достаточно, чтоб использовать наши программы, и мы просим вас довериться нам вновь. Мы нуждаемся в помощи. Выходите и протестуйте против этой бесполезной войны. Остановите кровопролитие. Скажите "Нет войне!"
>
> ## 🇺🇸 To Citizens of Russia
>
> We at Laminas come from all over the world. Many of us have friends, family and colleagues in both Russia and Ukraine. Some of us were born in Russia. Some of us currently live in Russia. Some have grandparents who fought Nazis in World War II. Nobody here supports fascism.
>
> One team member has a Ukrainian relative who fled her home with her son. The train was delayed due to bombing on the road ahead. We have friends who are hiding in bomb shelters. We anxiously follow up on them after the air raids, which indiscriminately fire at hospitals, schools, kindergartens and houses. We're not taking this from any media. These are our actual experiences.
>
> You trust us enough to use our software. We ask that you trust us to say the truth on this. We need your help. Go out and protest this unnecessary war. Stop the bloodshed. Say "stop the war!"`Laminas\Cache` provides a general cache system for PHP. The `Laminas\Cache` component
is able to cache different patterns (class, object, output, etc) using different
storage adapters (DB, File, Memcache, etc).- File issues at https://github.com/laminas/laminas-cache/issues
- Documentation is at https://docs.laminas.dev/laminas-cache/## Standalone
If this component is used without `laminas-mvc` or `mezzio`, a PSR-11 container to fetch services, adapters, plugins, etc. is needed.
The easiest way would be to use [laminas-config-aggregator](https://docs.laminas.dev/laminas-config-aggregator/) along with [laminas-servicemanager](https://docs.laminas.dev/laminas-servicemanager/).
```php
use Laminas\Cache\ConfigProvider;
use Laminas\Cache\Service\StorageAdapterFactoryInterface;
use Laminas\Cache\Storage\Adapter\Memory;
use Laminas\ConfigAggregator\ConfigAggregator;
use Laminas\ServiceManager\ServiceManager;$config = (new ConfigAggregator([
ConfigProvider::class,
]))->getMergedConfig();$dependencies = $config['dependencies'];
$container = new ServiceManager($dependencies);
/** @var StorageAdapterFactoryInterface $storageFactory */
$storageFactory = $container->get(StorageAdapterFactoryInterface::class);$storage = $storageFactory->create(Memory::class);
$storage->setItem('foo', 'bar');
```## Benchmarks
We provide scripts for benchmarking laminas-cache using the
[PHPBench](https://github.com/phpbench/phpbench) framework; these can be
found in the `benchmark/` directory of each storage adapter.To execute the benchmarks you can run the following command:
```bash
$ vendor/bin/phpbench run --report=aggregate
```