3c72e9878d
Will be used to cache blobs, thus removing the need to hit the database in most blob requests
16 lines
462 B
Python
16 lines
462 B
Python
import pytest
|
|
|
|
from data.cache import InMemoryDataModelCache, NoopDataModelCache
|
|
from data.cache.cache_key import CacheKey
|
|
|
|
@pytest.mark.parametrize('cache_type', [
|
|
(NoopDataModelCache),
|
|
(InMemoryDataModelCache),
|
|
])
|
|
def test_caching(cache_type):
|
|
key = CacheKey('foo', '60m')
|
|
cache = cache_type()
|
|
|
|
# Perform two retrievals, and make sure both return.
|
|
assert cache.retrieve(key, lambda: 1234) == 1234
|
|
assert cache.retrieve(key, lambda: 1234) == 1234
|