MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / ObjectCache

Class ObjectCache

suds/cache.py:359–383  ·  view source on GitHub ↗

Provides pickled object caching. @cvar protocol: The pickling protocol. @type protocol: int

Source from the content-addressed store, hash-verified

357
358
359class ObjectCache(FileCache):
360 """
361 Provides pickled object caching.
362 @cvar protocol: The pickling protocol.
363 @type protocol: int
364 """
365 protocol = 2
366
367 def fnsuffix(self):
368 return 'px'
369
370 def get(self, id):
371 try:
372 with FileCache.getf(self, id) as fp:
373 if fp is None:
374 return None
375 else:
376 return pickle.load(fp)
377 except:
378 FileCache.purge(self, id)
379
380 def put(self, id, object):
381 bfr = pickle.dumps(object, self.protocol)
382 FileCache.put(self, id, bfr)
383 return object

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected