Skip to main content

get_best_memcache

Returns the most efficient available memcache client class and a compatible key type by attempting to import pylibmc or falling back to a standard memcache implementation.

def get_best_memcache(
*args: any,
**kwargs: any
) - > tuple

Retrieves the most efficient available memcache client class and its associated key type based on the environment's installed libraries.

Parameters

NameTypeDescription
*argsanyPositional arguments passed to the underlying memcache client initialization.
**kwargsanyKeyword arguments passed to the underlying memcache client initialization, with 'behaviors' removed if pylibmc is unavailable.

Returns

TypeDescription
tupleA tuple containing the memcache Client class (potentially wrapped for compatibility) and the type used for cache keys.