1111class Cache
1212{
1313
14- /**
15- * Initiate cache database
16- *
17- * @var \Filebase\Database
18- */
19- private $ cache = new \Filebase \Database ([
20- 'dir ' => __DIR__ . DIRECTORY_SEPARATOR . 'cache/films/ ' ,
21- 'backupLocation ' => __DIR__ . DIRECTORY_SEPARATOR . 'cache/films/backups/ ' ,
22- 'format ' => \Filebase \Format \Json::class,
23- 'cache ' => true ,
24- 'cache_expires ' => 31540000 ,
25- 'pretty ' => false
26- ]);
14+ function __construct ()
15+ {
16+ /**
17+ * Initiate cache database
18+ *
19+ * @var \Filebase\Database
20+ */
21+ $ this ->cache = new \Filebase \Database ([
22+ 'dir ' => __DIR__ . DIRECTORY_SEPARATOR . 'cache/films/ ' ,
23+ 'backupLocation ' => __DIR__ . DIRECTORY_SEPARATOR . 'cache/films/backups/ ' ,
24+ 'format ' => \Filebase \Format \Json::class,
25+ 'cache ' => true ,
26+ 'cache_expires ' => 31540000 ,
27+ 'pretty ' => false
28+ ]);
29+ }
2730
2831 /**
2932 * Add (or modify) an item in the cache
@@ -47,7 +50,7 @@ public function add(string $key, $value)
4750 */
4851 public function count (): int
4952 {
50- return $ this ->$ cache ->count ();
53+ return $ this ->cache ->count ();
5154 }
5255
5356 /**
@@ -63,25 +66,25 @@ public function delete(string $key): bool
6366 }
6467
6568 /**
66- * Check if an item exists in the cache
69+ * Get an item from the cache
6770 *
6871 * @param string $key
69- * @return bool
72+ * @return object
7073 */
71- public function exists (string $ key ): bool
74+ public function get (string $ key ): object
7275 {
73- return $ this ->$ cache ->has ($ key );
76+ return $ this ->cache ->get ($ key );
7477 }
7578
7679 /**
77- * Get an item from the cache
80+ * Check if an item exists in the cache
7881 *
7982 * @param string $key
80- * @return array
83+ * @return bool
8184 */
82- public function get (string $ key ): array
85+ public function has (string $ key ): bool
8386 {
84- return $ this ->$ cache ->get ($ key );
87+ return $ this ->cache ->has ($ key );
8588 }
8689
8790}
0 commit comments