From 895a3dd6a2ff3a7ad72e49d1a76ffd8b4cc426ad Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 13 Aug 2023 12:04:26 +0300 Subject: [PATCH] update readme --- README.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/README.md b/README.md index 3f2d90b..52d349c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,58 @@ # 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 // cache time offset 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, // optional, cache timeout offset 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, // optional, cache timeout offset for this value + ); +``` \ No newline at end of file