[csw-devel] SF.net SVN: gar:[20168] csw/mgar/gar/v2/lib/python/rest.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Fri Jan 18 00:40:36 CET 2013


Revision: 20168
          http://gar.svn.sourceforge.net/gar/?rev=20168&view=rev
Author:   wahwah
Date:     2013-01-17 23:40:34 +0000 (Thu, 17 Jan 2013)
Log Message:
-----------
rest.py: Do not cache pkg-stats in RAM

In the previous era the whole catalog could fit in memory. It's no longer
possible, so don't attempt to cache everything in memory.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/rest.py

Modified: csw/mgar/gar/v2/lib/python/rest.py
===================================================================
--- csw/mgar/gar/v2/lib/python/rest.py	2013-01-17 23:08:17 UTC (rev 20167)
+++ csw/mgar/gar/v2/lib/python/rest.py	2013-01-17 23:40:34 UTC (rev 20168)
@@ -213,18 +213,14 @@
     self.filename = filename
     self.d = gdbm.open("%s.db" % self.filename, "c")
     self.rest_client = RestClient()
-    self.local_cache = {}
     self.deps = gdbm.open("%s-deps.db" % self.filename, "c")
 
   def GetPkgstats(self, md5):
-    if md5 in self.local_cache:
-      return self.local_cache[md5]
-    elif str(md5) in self.d:
+    if str(md5) in self.d:
       return cjson.decode(self.d[md5])
     else:
       pkgstats = self.rest_client.GetPkgstatsByMd5(md5)
       self.d[md5] = cjson.encode(pkgstats)
-      self.local_cache[md5] = pkgstats
       return pkgstats
 
   def GetDeps(self, md5):

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list