You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PSR Cache for [Luminova Framework](https://github.com/luminovang/luminova/)`CachePool`, `SimpleCache`.
4
-
To use this library you need to install Luminova Framework first.
3
+
The PSR Cache implementation for the [Luminova Framework](https://luminova.ng), [Luminova Framework GitHub](https://github.com/luminovang/luminova/)providing `CachePool` and `SimpleCache` class.
4
+
This library enables the use of both file-based and memory-based (Memcached) caching systems with an easy-to-use API.
5
5
6
+
For more information read the official [documentation](https://luminova.ng/docs/3.3.0/cache/psr).
6
7
7
-
### Installation
8
+
---
8
9
9
-
Via Composer
10
+
### Installation
10
11
11
-
```bash
12
+
Via Composer:
13
+
14
+
```bash
12
15
composer require nanoblocktech/psr-cache
13
16
```
14
17
15
-
### Usage
18
+
---
19
+
20
+
## Cache Pool Class
21
+
22
+
The `CachePool` class provides an interface to manage cache items.
23
+
It supports multiple cache storage driver, such as file-based or memory-based (Memcached) caching.
24
+
25
+
---
26
+
27
+
### Usage Example
28
+
16
29
```php
30
+
<?php
17
31
use \Luminova\Psr\Cache\CachePool;
18
32
use \Luminova\Psr\Cache\CacheItem;
19
33
20
-
$pool = new CachePool('my_cache', 'my_cache_folder_name');
// Rollback If any deferred commit failed to save, if you prefer not to recommit
97
+
// Rollback deferred cache items.
69
98
$pool->rollback(): bool;
70
99
71
-
// Deletes an item from the cache.
72
-
$pool->deleteItem(string 'cache_key'): bool;
100
+
// Delete a cache item by key.
101
+
$pool->deleteItem('cache_key'): bool;
73
102
74
-
// Deletes multiple items from the cache.
103
+
// Delete multiple cache items.
75
104
$pool->deleteItems(array ['key1', 'key2']): bool;
76
105
77
-
// Clear all cached entries
106
+
// Clear all cached entries.
78
107
$pool->clear(): bool;
79
108
```
80
109
110
+
---
111
+
112
+
## Simple Cache Class
113
+
114
+
The `SimpleCache` class provides a simplified interface for interacting with the cache.
115
+
It offers basic operations for storing and retrieving cached data, it supports multiple cache storage driver, such as file-based or memory-based (Memcached) caching.
116
+
117
+
---
118
+
119
+
### Usage Example
120
+
81
121
```php
122
+
<?php
82
123
use \Luminova\Psr\Cache\SimpleCache;
83
124
84
-
$simple = new SimpleCache(string 'my_cache', string 'my_cache_folder_name');
0 commit comments