1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.
A “dogpile” lock, one which allows a single thread to generate an expensive resource while other threads use the “old” value, until the “new” value is ready.
Dogpile is basically the locking code extracted from the Beaker package, for simple and generic usage.
Usage
A simple example:
from dogpile.core import Dogpile
# store a reference to a "resource", some
# object that is expensive to create.
the_resource = [None]
def some_creation_function():
# create the resource here
the_resource[0] = create_some_resource()
def use_the_resource():
# some function that uses
# the resource. Won't reach
# here until some_creation_function()
# has completed at least once.
the_resource[0].do_something()
# create Dogpile with 3600 second
# expiry time
dogpile = Dogpile(3600)
with dogpile.acquire(some_creation_function):
use_the_resource()
Above, some_creation_function() will be called when Dogpile.acquire() is first called. The remainder of the with block then proceeds. Concurrent threads which call Dogpile.acquire() during this initial period will be blocked until some_creation_function() completes.
Once the creation function has completed successfully the first time, new calls to Dogpile.acquire() will call some_creation_function() each time the “expiretime” has been reached, allowing only a single thread to call the function. Concurrent threads which call Dogpile.acquire() during this period will fall through, and not be blocked. It is expected that the “stale” version of the resource remain available at this time while the new one is generated.
dogpile.core is at the core of the dogpile.cache package which provides for a basic cache API and sample backends based on the dogpile concept.
Development Status
dogpile.core has been in use in a small number of production environments for a period of months, and as of 0.3.2 has entered beta status. No issues have been reported yet with its core synchronization model, and overall the project hasn’t seen many changes. Most development continues within dogpile.cache.
Release files for dogpile.core 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
File added late
1 file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release files before installing.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dogpile.core-0.4.1.tar.gz | 99.6 kB | Details |
Release files / dogpile.core-0.4.1.tar.gz
File added late
This file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release file before installing.
| Download URL | dogpile.core-0.4.1.tar.gz |
|---|---|
| Size | 99.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be652fb11a8eaf66f7e5c94d418d2eaa60a2fe81dae500f3743a863cc9dbed76
|
|
BLAKE2b-256 checksum How to use checksums |
0e77e72abc04c22aedf874301861e5c1e761231c288b5de369c18be8f4b5c9bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |