beaker.util – Beaker Utilities

Beaker utilities

Module Contents

beaker.util.encoded_path(root, identifiers, extension='.enc', depth=3, digest_filenames=True)

Generate a unique file-accessible path from the given list of identifiers starting at the given root directory.

beaker.util.func_namespace(func)

Generates a unique namespace for a function

class beaker.util.SyncDict

An efficient/threadsafe singleton map algorithm, a.k.a. “get a value based on this key, and create if not found or not valid” paradigm:

exists && isvalid ? get : create

Designed to work with weakref dictionaries to expect items to asynchronously disappear from the dictionary.

Use python 2.3.3 or greater ! a major bug was just fixed in Nov. 2003 that was driving me nuts with garbage collection/weakrefs in this section.

class beaker.util.ThreadLocal

stores a value on a per-thread basis

beaker.util.verify_directory(dir)

verifies and creates a directory. tries to ignore collisions with other threads and processes.

beaker.util.parse_cache_config_options(config, include_defaults=True)

Parse configuration options and validate for use with the CacheManager