Ce contenu n'est pas disponible dans la langue sélectionnée.

8.3. Configure Image Cache


You can configure the Image service API to have a local image cache. Caching of image files is transparent and can be performed by modifying some configuration parameters.
These parameters are configured in the PasteDeploy configuration file, component-paste.ini. You should not generally edit this file directly, as it ships with default options for all common deployment flavors.

8.3.1. Enable the Image Cache

To enable the image cache parameters, the cache parameters must occur in the application pipeline after the appropriate context parameters.
The cache parameters should be in your glance-api-paste.ini in a section titled [filter:cache]. It should look like this:
[filter:cache]
paste.filter_factory = glance.api.middleware.cache:CacheFilter.factory
Copy to Clipboard Toggle word wrap
A ready-made application parameter including this filter is defined in the glance-api-paste.ini file as follows:
[pipeline:glance-api-caching]
pipeline = versionnegotiation context cache apiv1app
Copy to Clipboard Toggle word wrap
To enable the above application parameter, in your main glance-api.conf configuration file, select the appropriate deployment flavor as follows:
[paste_deploy]
flavor = caching
Copy to Clipboard Toggle word wrap

8.3.2. Enable the Image Cache Management

There is an optional cachemanage option that allows you to directly interact with cache images. Use this flavor in place of the cache flavor in your API config file.
[paste_deploy]
flavor = cachemanage
Copy to Clipboard Toggle word wrap

8.3.3. Configuration Options Affecting the Image Cache

These configuration options must be set in both the glance-cache and glance-api configuration files.
Expand
Table 8.23. Description of Image Cache configuration options
Configuration option = Default value Description
image_cache_dir = /var/lib/glance/image-cache Required when image cache middleware is enabled. This is the base directory the image cache can write files to. Make sure the directory is writable by the user running the glance-api server.
image_cache_driver = sqlite (Optional) The default sqlite cache driver has no special dependencies, other than the python-sqlite3 library, which is installed on almost all operating systems with modern versions of Python. It stores information about the cached files in a SQLite database.
The xattr cache driver requires the python-xattr>=0.6.0 library and requires that the filesystem containing image_cache_dir has access times tracked for all files (in other words, the noatime option CANNOT be set for that filesystem). In addition, user_xattr must be set on the filesystem’s description line in fstab.
image_cache_sqlite_db = cache.db (Optional) When using the sqlite cache driver, you can set the name of the database that will be used to store the cached images information. The database is always contained in the image_cache_dir .
image_cache_max_size = 10737418240 (10 GB) (Optional) Size, in bytes, that the image cache should be constrained to. Images files are cached automatically in the local image cache, even if the writing of that image file would put the total cache size over this size. The glance-cache-pruner executable is what prunes the image cache to be equal to or less than this value. The glance-cache-pruner executable is designed to be run via cron on a regular basis.
Retour au début
Red Hat logoGithubredditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance. Découvrez nos récentes mises à jour.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez le Blog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

Theme

© 2025 Red Hat