From 35fe05c66dcb32686706f424bd7ad8589a0e5b55 Mon Sep 17 00:00:00 2001 From: Damiano Improta Date: Wed, 8 Oct 2025 18:05:16 +0200 Subject: [PATCH] Update README.md example with object --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 6e4951e..b32589a 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,23 @@ $res = $cache->set($key, $x); // get $y = $cache->get($key); // the value of $y is 8 + + + +//test with object + +$foo = new Foo(); //Foo implements Cacheable +$foo->x = 5; +$keyFoo = 'key_foo'; +$resFoo = $cache->set($keyFoo, $foo); +$fooCache = $cache->get($keyFoo); + +$testEqual = $keyFoo === $foo; //$testEquals could be false +$testEqualX = $keyFoo->x === $foo->x; //testEqualX is true ``` + + ### Multi cache level Example with apcu cache used with maximum priority and redis cache used with lower priority