You are here

protected function S3fsStreamWrapper::_delete_cache in S3 File System 7.2

Same name and namespace in other branches
  1. 7.3 S3fsStreamWrapper.inc \S3fsStreamWrapper::_delete_cache()
  2. 7 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 1334
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);
  if (!is_array($uri)) {
    $uri = array(
      $uri,
    );
  }

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