*
* @ingroup Cache
*/
-abstract class BagOStuff implements IExpiringStore, LoggerAwareInterface {
+abstract class BagOStuff implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInterface {
/** @var array[] Lock tracking */
protected $locks = [];
/** @var int ERR_* class constant */
* @return bool Success
*/
public function unlock( $key ) {
- if ( isset( $this->locks[$key] ) && --$this->locks[$key]['depth'] <= 0 ) {
+ if ( !isset( $this->locks[$key] ) ) {
+ return false;
+ }
+
+ if ( --$this->locks[$key]['depth'] <= 0 ) {
unset( $this->locks[$key] );
$ok = $this->doDelete( "{$key}:lock" );
* @param string $date The reference date in MW format
* @param callable|bool $progressCallback Optional, a function which will be called
* regularly during long-running operations with the percentage progress
- * as the first parameter.
+ * as the first parameter. [optional]
+ * @param int $limit Maximum number of keys to delete [default: INF]
*
* @return bool Success, false if unimplemented
*/
- public function deleteObjectsExpiringBefore( $date, $progressCallback = false ) {
+ public function deleteObjectsExpiringBefore( $date, $progressCallback = false, $limit = INF ) {
// stub
return false;
}