Code Duplication    Length = 25-26 lines in 2 locations

src/Memcache.php 1 location

@@ 76-100 (lines=25) @@
73
    /**
74
     * {@inheritdoc}
75
     */
76
    public function save($data, $key, array $tags = null, $ttl = null)
77
    {
78
        $ttl = $this->sanitiseTtl($ttl);
79
80
        $mKey = $this->mapKey($key);
81
82
        $data = array('data' => $data, 'ttl' => $ttl);
83
        $this->ttls[$mKey] = $ttl;
84
85
        // add the item
86
        $success = $this->adapter->set($mKey, $data, $ttl);
87
88
        if ($success && $this->options['tag_enable'] && !empty($tags)) {
89
90
            // add all the tags to the index key.
91
            $this->getIndex($this->mapIdx($key))->add($tags);
92
93
            // append the key to each tag.
94
            foreach ($tags as $tag) {
95
                $this->getIndex($this->mapTag($tag))->add($mKey);
96
            }
97
        }
98
99
        return $success;
100
    }
101
102
    /**
103
     * {@inheritdoc}

src/Memcached.php 1 location

@@ 87-112 (lines=26) @@
84
    /**
85
     * {@inheritdoc}
86
     */
87
    public function save($data, $key, array $tags=null, $ttl=null)
88
    {
89
        $ttl = $this->sanitiseTtl($ttl);
90
91
        $mKey = $this->mapKey($key);
92
93
        $data = array('data' => $data, 'ttl' => $ttl);
94
        $this->ttls[$mKey] = $ttl;
95
96
        // add the item
97
        $success = $this->adapter->set($mKey, $data, $ttl);
98
99
        if ($success && $this->options['tag_enable'] && !empty($tags)) {
100
101
            // add all the tags to the index key.
102
            $this->getIndex($this->mapIdx($key))->add($tags);
103
104
            // append the key to each tag.
105
            foreach ($tags as $tag) {
106
                $this->getIndex($this->mapTag($tag))->add($mKey);
107
            }
108
109
        }
110
111
        return $success;
112
    }
113
114
    /**
115
     * {@inheritdoc}