# glance.image_cache.drivers.centralized_db module

Cache driver that uses Centralized database of glance to store information about cached images

class glance.image_cache.drivers.centralized_db.Driver

  Bases: `Driver`

  Cache driver that uses centralized database to store cache information.

  clean(stall_time=None)

    Delete any image files in the invalid directory and any files in the incomplete directory that are older than a configurable amount of time.

  configure()

    Configure the driver to use the stored configuration options Any store that needs special configuration should implement this method. If the store was not able to successfully configure itself, it should raise exception.BadDriverConfiguration

  delete_all_cached_images()

    Removes all cached image files and any attributes about the images

  delete_all_queued_images()

    Removes all queued image files and any attributes about the images

  delete_cached_image(image_id)

    Removes a specific cached image file and any attributes about the image

    Parameters:

      image_id – Image ID

  delete_invalid_files()

    Removes any invalid cache entries

  delete_queued_image(image_id)

    Removes a specific queued image file and any attributes about the image

    Parameters:

      image_id – Image ID

  delete_stalled_files(older_than)

    Removes any incomplete cache entries older than a supplied modified time.

    Parameters:

      older_than – Files written to on or before this timestamp will be deleted.

  get_cache_files(basepath)

    Returns cache files in the supplied directory

    Parameters:

      basepath – Directory to look in for cache files

  get_cache_size()

    Returns the total size in bytes of the image cache.

  get_cached_images()

    Returns a list of records about cached images.

  get_hit_count(image_id)

    Return the number of hits that an image has.

    Parameters:

      image_id – Opaque image identifier

  get_least_recently_accessed()

    Return a tuple containing the image_id and size of the least recently accessed cached file, or None if no cached files.

  get_queued_images()

    Returns a list of image IDs that are in the queue. The list should be sorted by the time the image ID was inserted into the queue.

  is_being_cached(image_id)

    Returns True if the image with supplied id is currently in the process of having its image file cached.

    Parameters:

      image_id – Image ID

  is_cacheable(image_id)

    Returns True if the image with the supplied ID can have its image file cached, False otherwise.

    Parameters:

      image_id – Image ID

  is_cached(image_id)

    Returns True if the image with the supplied ID has its image file cached.

    Parameters:

      image_id – Image ID

  is_queued(image_id)

    Returns True if the image identifier is in our cache queue.

    Parameters:

      image_id – Image ID

  open_for_read(image_id)

    Open and yield file for reading the image file for an image with supplied identifier.

    Parameters:

      image_id – Image ID

  open_for_write(image_id)

    Open a file for writing the image file for an image with supplied identifier.

    Parameters:

      image_id – Image ID

  queue_image(image_id)

    This adds a image to be cache to the queue.

    If the image already exists in the queue or has already been cached, we return False, True otherwise

    Parameters:

      image_id – Image ID

glance.image_cache.drivers.centralized_db.delete_cached_file(path)

this page last updated: 2026-03-19 01:38:33

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.

found an error? report a bug