python - Why is appengine memcache not storing my data for the requested period of time? -


i have employees stored in appengine ndb , i'm running cron job via taskque generate list of dictionaries containing email address of each employee. resulting list looks this:

[{"text":"john@mycompany.com"},{"text":"mary@mycompany.com"},{"text":"paul@mycompany.com"}] 

the list used source data varing angular components such ngtags ngautocomplete etc. want store list in memcache angular http calls run faster.

the problem i'm having values stored in memcache never last more few minutes though i've set last 26 hours. i'm aware actual value stored can not on 1mb experiment hardcoded list of employees contain 3 values , problem still persists.

the appengine console telling me job ran , if run job manually load values memcache they'll stay there few minutes. i've done many times before far greater amount of data can't understand what's going wrong. have billing enabled , i'm not on quota.

here example of function used load data memcache:

def update_employee_list(): try:     # 3000+ employees , generate list of dictionaries     fresh_emp_list = [{"text":"john@mycompany.com"},{"text":"mary@mycompany.com"},{"text":"paul@mycompany.com"}]      the_cache_key = 'my_emp_list'     emp_data = memcache.get(the_cache_key)      # kill memcache packet can rebuild it.     if emp_data not none:         memcache.delete(the_cache_key)      # rebuild memcache packet           memcache.add(the_cache_key, fresh_emp_list, 93600) # should last 26 hours    except exception e:     logging.info('error!!!...a failure occured while trying setup memcache packet: %s'%e.message)     raise deferred.permanenttaskfailure()  

here example of function angular components use data memcache:

@route def get_emails(self):     self.meta.change_view('json')     emp_emails = memcache.get('my_emp_list')     if emp_emails not none:         self.context['data'] = emp_emails     else:         self.context['data'] = []  

here example of cron setting in cron.yaml:

- url: /cron/lookups/update_employee_list   description: daily rebuild of employee data   schedule: every day 06:00   timezone: america/new_york  

why can't appengine memcache hold on list of 3 dictionaries more few minutes?

any ideas appreciated. thanks

unless using dedicated memcache (paid service) cached values can , evicted @ time.

what tell memcache specifying lifetime when value becomes invalid , can therefor removed memcache. not guarantee value stay long in memcache, it's capping cache value's maximum lifetime.

note: more put in memcache more other values dropped. therefor should consider data put in cache. should not put every value come across in memcache.

on sidenote: in projects worked in, had - sort of - maximum cache lifetime of day. no cache value ever lasted longer that, if desired lifetime higher. interestingly enough though cache got cleared out @ same time every day, including new values.

thus: never rely on memcache. use persistent storage , memcache performance boosts high volume traffic.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -