anubhav77 commited on
Commit
8f133db
·
1 Parent(s): 390d012
Files changed (1) hide show
  1. src/baseInfra/dbInterface.py +10 -12
src/baseInfra/dbInterface.py CHANGED
@@ -64,9 +64,7 @@ class DbInterface:
64
  if cache == None:
65
  return []
66
  else:
67
- for item in cache: #ie cache is list of dicts {'input':inStr,'value':cached_items_list}
68
- if item['input'] == input:
69
- return item['value']
70
 
71
  return []
72
 
@@ -81,15 +79,15 @@ class DbInterface:
81
  """
82
  retVal=False
83
  fb_key=fbh.convert_to_firebase_key(input)
84
- cache = fb.get(self.base_dir+"/"+self.cache_loc, fb_key)
85
- if cache is None:
86
- cache = []
87
- else:
88
- for item in cache: #ie cache is list of dicts {'input':inStr,'value':cached_items_list}
89
- if item['input'] == input:
90
- item['value']=value
91
- retVal=True
92
- #cache.append({'input':input,'value':value})
93
  cache={'input':input,'value':value}
94
  fb.patch(self.base_dir+"/"+self.cache_loc, {fb_key:cache})
95
  return retVal
 
64
  if cache == None:
65
  return []
66
  else:
67
+ return cache['value']
 
 
68
 
69
  return []
70
 
 
79
  """
80
  retVal=False
81
  fb_key=fbh.convert_to_firebase_key(input)
82
+ #cache = fb.get(self.base_dir+"/"+self.cache_loc, fb_key)
83
+ # if cache is None:
84
+ # cache = {}
85
+ # else:
86
+ # for item in cache: #ie cache is list of dicts {'input':inStr,'value':cached_items_list}
87
+ # if item['input'] == input:
88
+ # item['value']=value
89
+ # retVal=True
90
+ # #cache.append({'input':input,'value':value})
91
  cache={'input':input,'value':value}
92
  fb.patch(self.base_dir+"/"+self.cache_loc, {fb_key:cache})
93
  return retVal