Add support for [cache] backend_expiration_time

Depends-on: https://review.opendev.org/932301
Change-Id: Iaf4082ce3bff32712d2c26cbaca4a70d19066472
This commit is contained in:
Takashi Kajinami 2024-11-02 23:05:07 +09:00
parent 6b04e13ad4
commit c866d86a06
3 changed files with 16 additions and 2 deletions

View File

@ -50,6 +50,11 @@
# (integer value)
# Defaults to $facts['os_service_default']
#
# [*backend_expiration_time*]
# (Optional) Expiration time in cache backend to purge expired records
# automatically.
# Defaults to $facts['os_service_default']
#
# [*backend*]
# (Optional) Dogpile.cache backend module. It is recommended that
# Memcache with pooling (oslo_cache.memcache_pool) or Redis
@ -251,6 +256,7 @@
define oslo::cache(
$config_prefix = $facts['os_service_default'],
$expiration_time = $facts['os_service_default'],
$backend_expiration_time = $facts['os_service_default'],
$backend = $facts['os_service_default'],
$backend_argument = $facts['os_service_default'],
$proxies = $facts['os_service_default'],
@ -360,6 +366,7 @@ define oslo::cache(
$cache_options = {
'cache/config_prefix' => { value => $config_prefix },
'cache/expiration_time' => { value => $expiration_time },
'cache/backend_expiration_time' => { value => $backend_expiration_time },
'cache/backend' => { value => $backend },
'cache/backend_argument' => { value => $backend_argument },
'cache/proxies' => { value => join(any2array($proxies), ',') },

View File

@ -0,0 +1,4 @@
---
features:
- |
The new ``oslo::cache::backend_expiration_time`` parameter has been added.

View File

@ -10,6 +10,7 @@ describe 'oslo::cache' do
it 'configure oslo_cache default params' do
is_expected.to contain_keystone_config('cache/config_prefix').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/expiration_time').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/backend_expiration_time').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/backend').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/backend_argument').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/proxies').with_value('<SERVICE DEFAULT>')
@ -53,7 +54,8 @@ describe 'oslo::cache' do
let :params do
{
:config_prefix => 'cache.oslo',
:expiration_time => '600',
:expiration_time => 600,
:backend_expiration_time => 700,
:backend => 'dogpile.cache.null',
:backend_argument => ['arg1:val1', 'arg2:val2'],
:proxies => ['proxy1', 'proxy2'],
@ -95,7 +97,8 @@ describe 'oslo::cache' do
it 'configures cache section' do
is_expected.to contain_keystone_config('cache/config_prefix').with_value('cache.oslo')
is_expected.to contain_keystone_config('cache/expiration_time').with_value('600')
is_expected.to contain_keystone_config('cache/expiration_time').with_value(600)
is_expected.to contain_keystone_config('cache/backend_expiration_time').with_value(700)
is_expected.to contain_keystone_config('cache/backend').with_value('dogpile.cache.null')
is_expected.to contain_keystone_config('cache/backend_argument').with_value(['arg1:val1', 'arg2:val2'])
is_expected.to contain_keystone_config('cache/proxies').with_value('proxy1,proxy2')