https://github.com/renyu106/easy-cache
A lightweight and efficient PHP caching system, designed for simplicity and ease of use.
https://github.com/renyu106/easy-cache
php php-caching
Last synced: about 1 year ago
JSON representation
A lightweight and efficient PHP caching system, designed for simplicity and ease of use.
- Host: GitHub
- URL: https://github.com/renyu106/easy-cache
- Owner: Renyu106
- License: mit
- Created: 2023-08-28T17:17:38.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-17T02:39:23.000Z (over 2 years ago)
- Last Synced: 2025-02-16T23:27:40.763Z (over 1 year ago)
- Topics: php, php-caching
- Language: PHP
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## PHP Cache Class
This is a simple PHP caching class that allows you to save, retrieve, and delete cache data using files.
### Features
- **Efficient Storage**: Data is stored in a compressed and base64-encoded format.
- **Metadata**: Each cache item contains metadata such as its creation and last updated time.
- **Flexible Directory Structure**: If the designated cache directory does not exist, the class will automatically create it.
### Prerequisites
Ensure that the directory where you want to store cache files has the appropriate write permissions. You should also set a constant or variable named `CACHE_LOCATION` with the directory path where cache files should be saved.
### How to Use
1. **Include the Cache Class**:
```php
include 'CACHE.php';
```
2. **Initialize**:
```php
$cache = new CACHE();
```
3. **Save Data to Cache**:
```php
$result = $cache->SAVE('my_data_key', array('some' => 'data'));
```
4. **Retrieve Data from Cache**:
```php
$data = $cache->GET('my_data_key');
```
5. **Delete Data from Cache**:
```php
$result = $cache->DELETE('my_data_key');
```
### Responses
The class will return an associative array containing the status of the operation (`"OK"` or `"ERR"`) and a message describing the outcome. For successful `GET` operations, the data will also be included.
### Contributions
Feel free to contribute to this project by submitting pull requests or issues.
### License
This project is open-source and licensed under the MIT License. See the [LICENSE](LICENSE) file for details.