Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yggverse/cache-php
Cache tools for PHP applications
https://github.com/yggverse/cache-php
cache cache-php memcached php php-memcached
Last synced: about 1 month ago
JSON representation
Cache tools for PHP applications
- Host: GitHub
- URL: https://github.com/yggverse/cache-php
- Owner: YGGverse
- License: mit
- Created: 2023-08-09T16:26:00.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-02T23:01:16.000Z (11 months ago)
- Last Synced: 2024-11-16T14:47:44.903Z (about 1 month ago)
- Topics: cache, cache-php, memcached, php, php-memcached
- Language: PHP
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cache-php
Cache tools for PHP applications### Memory
Extends [PHP memcached](https://www.php.net/manual/en/book.memcached.php)
#### Init
```
$memory = new \Yggverse\Cache\Memory('localhost', // memcached server host, localhost by default
11211, // memcached server port, 11211 by default'my_app', // application namespace
3600 + time() // cache time by default
);
```#### Supported methods
##### Memory::set
##### Memory::delete
##### Memory::flush
##### Memory::get
##### Memory::getByValueCallback
Return cached or cache new value of plain value callback
```
$value = $memory->getByValueCallback(
'key_name', // string, unique key name
'value', // mixed, plain value
3600 + time(), // optional, cache timeout for this value
);
```##### Memory::getByMethodCallback
Return cached or cache new value of object method callback
```
$value = $memory->getByMethodCallback(
$class_object, // object of method class
'method_name', // object method name
[
$method_attribute_1, // optional, array of attributes callback method requires
$method_attribute_2,
...
]
3600 + time(), // optional, cache timeout for this value
);
```