Methods

This is invoked early on by abc.ABCMeta.__subclasscheck__().
It should return True, False or NotImplemented. If it returns
NotImplemented, the normal algorithm is used. Otherwise, it
overrides the normal algorithm (and the outcome is cached).

Every cullFrequency times that an item is retrieved from
this cache, the cull method is called.

The cull method then expires an arbitrary fraction of
the cached objects. The idea is at no time will the cache
be entirely emptied, placing a potentially high load at that
moment, but everything object will have its time to go
eventually. The fraction is given as an integer, and one
in that many objects are expired (i.e., the default is 1/2
of objects are expired).

By setting cache to False, items won't be cached.

However, in all cases a weak reference is kept to created
objects, and if the object hasn't been garbage collected
it will be returned.

This returns the object found in cache, or None. If None,
then the cache will remain locked! This is so that the
calling function can create the object in a threadsafe manner
before releasing the lock. You should use this like (note
that cache is actually a CacheSet object in this
example):

Inserts and object into the cache. Should be used when no one
else knows about the object yet, so there cannot be any object
already in the cache. After a database INSERT is an example
of this situation.