1+ <?php
2+
3+ use phpFastCache \CacheManager ;
4+
5+ // Include composer autoloader
6+ require '../src/autoload.php ' ;
7+
8+ if (!isset ($ InstanceCache )) {
9+ $ InstanceCache = CacheManager::getInstance ();
10+ }
11+
12+ function break_line () {
13+ echo "<br><hr><br> " ;
14+ }
15+
16+ function output ($ string ) {
17+ echo $ string ."\r\n<br> " ;
18+ }
19+ break_line ();
20+ $ key = "key1 " ;
21+ output ("Test Get " );
22+ $ value = $ InstanceCache ->get ($ key );
23+ output ("{$ key } = {$ value }" );
24+ break_line ();
25+ output ("Write Data 123456 " );
26+ $ InstanceCache ->set ($ key ,"123456 " ,300 );
27+ break_line ();
28+ output ("Read Data Again " );
29+ $ value = $ InstanceCache ->get ($ key );
30+ output ("{$ key } = {$ value }" );
31+ break_line ();
32+ output ("Delete Key " );
33+ $ InstanceCache ->delete ($ key );
34+ $ value = $ InstanceCache ->get ($ key );
35+ output ("{$ key } = {$ value }" );
36+ break_line ();
37+ output ("Write Data 100 " );
38+ $ InstanceCache ->set ($ key ,100 ,300 );
39+ output ("Increase by 10 " );
40+ $ InstanceCache ->increment ($ key ,10 );
41+ $ value = $ InstanceCache ->get ($ key );
42+ output ("{$ key } = {$ value }" );
43+ output ("Decrease by 10 " );
44+ $ InstanceCache ->decrement ($ key ,10 );
45+ $ value = $ InstanceCache ->get ($ key );
46+ output ("{$ key } = {$ value }" );
47+ break_line ();
48+ output ("Finished Testing, Caching is Working Good " );
0 commit comments