Back to Cache class

Method unlock

public bool
unlock
(mixed $id, mixed $group = null)
Unset lock flag on cached item
Parameters
  • string $id The cache data ID
  • string $group The cache data group
Returns
  • bool
Since
  • 1.7.0
Class: Cache
Project: Joomla

Method unlock - Source code

/**
 * Unset lock flag on cached item
 *
 * @param   string  $id     The cache data ID
 * @param   string  $group  The cache data group
 *
 * @return  boolean
 *
 * @since   1.7.0
 */
public function unlock($id, $group = null)
{
    if (!$this->getCaching()) {
        return false;
    }
    // Get the default group
    $group = $group ?: $this->_options['defaultgroup'];
    // Allow handlers to perform unlocking on their own
    $handler = $this->_getStorage();
    $unlocked = $handler->unlock($id, $group);
    if ($unlocked !== false) {
        return $unlocked;
    }
    // Fallback
    return $handler->remove($id . '_lock', $group);
}