Skip to content

Commit

Permalink
Core & Internals: allow external cache for auth tokens. Closes rucio#…
Browse files Browse the repository at this point in the history
…5297

Allow setting auth tokens in memcached, but make it configurable and
default this behavior to disabled.
  • Loading branch information
rcarpa committed Mar 2, 2022
1 parent 0b93415 commit 5cf1454
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/rucio/core/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@
from base64 import b64decode

import paramiko
from dogpile.cache import make_region
from dogpile.cache.api import NO_VALUE
from dogpile.cache import make_region
from sqlalchemy import and_, or_, select, delete

from rucio.common.cache import make_region_memcached
from rucio.common.config import config_get_bool
from rucio.common.exception import CannotAuthenticate, RucioException
from rucio.common.utils import chunks, generate_uuid
from rucio.core.account import account_exists
Expand All @@ -59,12 +61,10 @@ def generate_key(token, session=None):
return generate_key


TOKENREGION = make_region(
function_key_generator=token_key_generator
).configure(
'dogpile.cache.memory',
expiration_time=3600
)
if config_get_bool('cache', 'use_external_cache_for_auth_tokens', default=False):
TOKENREGION = make_region_memcached(expiration_time=3600, function_key_generator=token_key_generator)
else:
TOKENREGION = make_region(function_key_generator=token_key_generator).configure('dogpile.cache.memory', expiration_time=3600)


@transactional_session
Expand Down

0 comments on commit 5cf1454

Please sign in to comment.