Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gemberphp/cache-psr
Gember Event Sourcing Cache adapter based on psr/simple-cache (PSR-16)
https://github.com/gemberphp/cache-psr
cache cqrs ddd domain-driven-design event-sourcing gember php-fig psr-16 simple-cache
Last synced: about 1 month ago
JSON representation
Gember Event Sourcing Cache adapter based on psr/simple-cache (PSR-16)
- Host: GitHub
- URL: https://github.com/gemberphp/cache-psr
- Owner: GemberPHP
- License: mit
- Created: 2024-08-09T14:23:04.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-10-12T13:44:39.000Z (2 months ago)
- Last Synced: 2024-11-09T15:52:07.356Z (about 1 month ago)
- Topics: cache, cqrs, ddd, domain-driven-design, event-sourcing, gember, php-fig, psr-16, simple-cache
- Language: PHP
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🫚 Gember Cache: PSR SimpleCache (PSR-16)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE)
[![PHP Version](https://img.shields.io/badge/php-%5E8.3-8892BF.svg?style=flat)](http://www.php.net)[Gember Event Sourcing](https://github.com/GemberPHP/event-sourcing) Cache adapter based on [psr/simple-cache](https://github.com/php-fig/simple-cache) (PSR-16).
> All external dependencies in Gember Event Sourcing are organized into separate packages,
> making it easy to swap out a vendor adapter for another.## Installation
Install with Composer:
```bash
composer require gember/cache-psr
```## Configuration
Bind this adapter to the `Cache` interface in your service definitions.### Examples
#### Vanilla PHP
```php
use Gember\CachePsr\PsrSimpleCache;$cache = new PsrSimpleCache(
new SomeSimpleCacheAdapter(), // An implementation of Psr\SimpleCache\CacheInterface of your choice
);
```
You will need to install a PSR-16 Cache implementation as well. Some available packages:
- [symfony/cache](https://github.com/symfony/cache)
- [laminas/laminas-cache](https://github.com/laminas/laminas-cache)
- [phpfastcache/phpfastcache](https://github.com/PHPSocialNetwork/phpfastcache)#### Symfony
It is recommended to use the [Symfony bundle](https://github.com/GemberPHP/event-sourcing-symfony-bundle) to configure Gember Event Sourcing.
With this bundle, the adapter is automatically set as the default for Cache.If you're not using the bundle, you can bind it directly to the `Cache` interface.
```yaml
Gember\EventSourcing\Util\Cache\Cache:
class: Gember\CachePsr\PsrSimpleCache\PsrSimpleCache
arguments:
- '@cache.app' # or any other Symfony Cache definition of your choice
```