Skip to content

Commit f659159

Browse files
committed
Added reload() and delete() methods for proper counter reset.
1 parent 16e2f8a commit f659159

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/AbstractCounter.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,32 @@ protected function getExpiry()
132132
return $this->expiry;
133133
}
134134

135+
/**
136+
* Reload counter with initial value
137+
*
138+
* @return bool
139+
*/
140+
public function reload()
141+
{
142+
return $this->client->set(
143+
$this->getKey(),
144+
$this->getInitialValue(),
145+
$this->getExpiry()
146+
);
147+
}
148+
149+
/**
150+
* Delete counter
151+
*
152+
* @return bool
153+
*/
154+
public function delete()
155+
{
156+
return $this->client->delete(
157+
$this->getKey()
158+
);
159+
}
160+
135161
/**
136162
* Method for building cache key based on $item value
137163
*

0 commit comments

Comments
 (0)