Browse Source

Update wincache to be psr16 compatible implementation

Mark Story 7 years ago
parent
commit
847cb51bec
1 changed files with 8 additions and 9 deletions
  1. 8 9
      src/Cache/Engine/WincacheEngine.php

+ 8 - 9
src/Cache/Engine/WincacheEngine.php

@@ -56,9 +56,12 @@ class WincacheEngine extends CacheEngine
      *
      * @param string $key Identifier for the data
      * @param mixed $value Data to be cached
+     * @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
+     *   the driver supports TTL then the library may set a default value
+     *   for it or let the driver take care of that.
      * @return bool True if the data was successfully cached, false on failure
      */
-    public function write(string $key, $value): bool
+    public function set($key, $value, $ttl = null)
     {
         $key = $this->_key($key);
         $duration = $this->_config['duration'];
@@ -70,10 +73,11 @@ class WincacheEngine extends CacheEngine
      * Read a key from the cache
      *
      * @param string $key Identifier for the data
+     * @param mixed $default Default value to return if the key does not exist.
      * @return mixed The cached data, or false if the data doesn't exist,
      *   has expired, or if there was an error fetching it
      */
-    public function read(string $key)
+    public function get($key, $default = null)
     {
         $key = $this->_key($key);
 
@@ -114,7 +118,7 @@ class WincacheEngine extends CacheEngine
      * @param string $key Identifier for the data
      * @return bool True if the value was successfully deleted, false if it didn't exist or couldn't be removed
      */
-    public function delete(string $key): bool
+    public function delete($key)
     {
         $key = $this->_key($key);
 
@@ -125,15 +129,10 @@ class WincacheEngine extends CacheEngine
      * Delete all keys from the cache. This will clear every
      * item in the cache matching the cache config prefix.
      *
-     * @param bool $check If true, nothing will be cleared, as entries will
-     *   naturally expire in wincache..
      * @return bool True Returns true.
      */
-    public function clear(bool $check): bool
+    public function clear()
     {
-        if ($check) {
-            return true;
-        }
         $info = wincache_ucache_info();
         $cacheKeys = $info['ucache_entries'];
         unset($info);