Skip to content

Commit b978cc2

Browse files
committed
chg: [search mail] increase cache
1 parent 9f3f239 commit b978cc2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bin/lib/objects/Mails.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,13 +383,14 @@ def search_mail(mail=None, username=None, domain=None, s_username=None, s_domain
383383
def cache_search_mail(to_cache, username='', domain='', s_username='', s_domain=''):
384384
for result in to_cache:
385385
r_cache.rpush(f'm:{username}:{domain}:{s_username}:{s_domain}', result)
386-
r_cache.expire(f'm:{username}:{domain}:{s_username}:{s_domain}', 600)
386+
r_cache.expire(f'm:{username}:{domain}:{s_username}:{s_domain}', 1800)
387387

388388
def get_cache_search_mail(username='', domain='', s_username='', s_domain='', page=1, nb=500):
389389
total = r_cache.llen(f'm:{username}:{domain}:{s_username}:{s_domain}')
390390
if not total:
391391
return None, None
392392
else:
393+
r_cache.expire(f'm:{username}:{domain}:{s_username}:{s_domain}', 1800)
393394
start = nb * (page - 1)
394395
stop = start + nb - 1
395396
return total, r_cache.lrange(f'm:{username}:{domain}:{s_username}:{s_domain}', start, stop)

0 commit comments

Comments
 (0)