mirror of
https://github.com/krateng/maloja.git
synced 2025-06-09 20:02:28 +03:00
Removed previous ability, but this time clean and consistent
This commit is contained in:
parent
7c77474feb
commit
d5f5b48d85
@ -10,6 +10,11 @@ from doreah.logging import log
|
|||||||
|
|
||||||
from ..pkg_global.conf import malojaconfig
|
from ..pkg_global.conf import malojaconfig
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if malojaconfig['USE_GLOBAL_CACHE']:
|
||||||
CACHE_SIZE = 1000
|
CACHE_SIZE = 1000
|
||||||
ENTITY_CACHE_SIZE = 100000
|
ENTITY_CACHE_SIZE = 100000
|
||||||
|
|
||||||
@ -22,7 +27,6 @@ hits, misses = 0, 0
|
|||||||
|
|
||||||
@runhourly
|
@runhourly
|
||||||
def maintenance():
|
def maintenance():
|
||||||
if malojaconfig['USE_GLOBAL_CACHE']:
|
|
||||||
print_stats()
|
print_stats()
|
||||||
trim_cache()
|
trim_cache()
|
||||||
|
|
||||||
@ -36,9 +40,7 @@ def print_stats():
|
|||||||
|
|
||||||
def cached_wrapper(inner_func):
|
def cached_wrapper(inner_func):
|
||||||
|
|
||||||
|
|
||||||
def outer_func(*args,**kwargs):
|
def outer_func(*args,**kwargs):
|
||||||
if not malojaconfig['USE_GLOBAL_CACHE']: inner_func(*args,**kwargs)
|
|
||||||
|
|
||||||
if 'dbconn' in kwargs:
|
if 'dbconn' in kwargs:
|
||||||
conn = kwargs.pop('dbconn')
|
conn = kwargs.pop('dbconn')
|
||||||
@ -67,7 +69,6 @@ def cached_wrapper_individual(inner_func):
|
|||||||
|
|
||||||
|
|
||||||
def outer_func(set_arg,**kwargs):
|
def outer_func(set_arg,**kwargs):
|
||||||
if not malojaconfig['USE_GLOBAL_CACHE']: return inner_func(set_arg,**kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
if 'dbconn' in kwargs:
|
if 'dbconn' in kwargs:
|
||||||
@ -129,6 +130,20 @@ def trim_cache():
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
else:
|
||||||
|
def cached_wrapper(func):
|
||||||
|
return func
|
||||||
|
def cached_wrapper_individual(func):
|
||||||
|
return func
|
||||||
|
def invalidate_caches(scrobbletime=None):
|
||||||
|
return None
|
||||||
|
def invalidate_entity_cache():
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def serialize(obj):
|
def serialize(obj):
|
||||||
try:
|
try:
|
||||||
return serialize(obj.hashable())
|
return serialize(obj.hashable())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user