Code Duplication    Length = 18-18 lines in 3 locations

src/think/cache/driver/Memcache.php 1 location

@@ 109-126 (lines=18) @@
106
     * @param int|\DateTime $expire 有效时间(秒)
107
     * @return bool
108
     */
109
    public function set($name, $value, $expire = null): bool
110
    {
111
        $this->writeTimes++;
112
113
        if (is_null($expire)) {
114
            $expire = $this->options['expire'];
115
        }
116
117
        $key    = $this->getCacheKey($name);
118
        $expire = $this->getExpireTime($expire);
119
        $value  = $this->serialize($value);
120
121
        if ($this->handler->set($key, $value, 0, $expire)) {
122
            return true;
123
        }
124
125
        return false;
126
    }
127
128
    /**
129
     * 自增缓存(针对数值缓存)

src/think/cache/driver/Memcached.php 1 location

@@ 123-140 (lines=18) @@
120
     * @param integer|\DateTime $expire 有效时间(秒)
121
     * @return bool
122
     */
123
    public function set($name, $value, $expire = null): bool
124
    {
125
        $this->writeTimes++;
126
127
        if (is_null($expire)) {
128
            $expire = $this->options['expire'];
129
        }
130
131
        $key    = $this->getCacheKey($name);
132
        $expire = $this->getExpireTime($expire);
133
        $value  = $this->serialize($value);
134
135
        if ($this->handler->set($key, $value, $expire)) {
136
            return true;
137
        }
138
139
        return false;
140
    }
141
142
    /**
143
     * 自增缓存(针对数值缓存)

src/think/cache/driver/Wincache.php 1 location

@@ 89-106 (lines=18) @@
86
     * @param integer|\DateTime $expire 有效时间(秒)
87
     * @return bool
88
     */
89
    public function set($name, $value, $expire = null): bool
90
    {
91
        $this->writeTimes++;
92
93
        if (is_null($expire)) {
94
            $expire = $this->options['expire'];
95
        }
96
97
        $key    = $this->getCacheKey($name);
98
        $expire = $this->getExpireTime($expire);
99
        $value  = $this->serialize($value);
100
101
        if (wincache_ucache_set($key, $value, $expire)) {
102
            return true;
103
        }
104
105
        return false;
106
    }
107
108
    /**
109
     * 自增缓存(针对数值缓存)