You are here

protected function S3fsStreamWrapper::_delete_cache in S3 File System 7

Same name and namespace in other branches
  1. 7.3 S3fsStreamWrapper.inc \S3fsStreamWrapper::_delete_cache()
  2. 7.2 S3fsStreamWrapper.inc \S3fsStreamWrapper::_delete_cache()

Delete an object's metadata from the cache.

Parameters

mixed $uri: A string (or array of strings) containing the URI(s) of the object(s) to be deleted.

Throws

Exceptions which occur in the database call will percolate.

2 calls to S3fsStreamWrapper::_delete_cache()
S3fsStreamWrapper::rmdir in ./S3fsStreamWrapper.inc
Support for rmdir().
S3fsStreamWrapper::unlink in ./S3fsStreamWrapper.inc
Support for unlink().

File

./S3fsStreamWrapper.inc, line 1245
Drupal stream wrapper implementation for S3 File System.

Class

S3fsStreamWrapper
The stream wrapper class.

Code

protected function _delete_cache($uri) {
  $this
    ->_debug("_delete_cache({$uri}) called.", TRUE);
  $delete_query = db_delete('s3fs_file');
  if (is_array($uri)) {

    // Build an OR condition to delete all the URIs in one query.
    $or = db_or();
    foreach ($uri as $u) {
      $or
        ->condition('uri', $u, '=');
    }
    $delete_query
      ->condition($or);
  }
  else {
    $delete_query
      ->condition('uri', $uri, '=');
  }
  return $delete_query
    ->execute();
}