Debian Codegraph @

cachey.egg-info/PKG-INFO

raw
1 Metadata-Version: 2.1
2 Name: cachey
3 Version: 0.2.1
4 Summary: Caching mindful of computation/storage costs
5 Home-page: http://github.com/dask/cachey/
6 Maintainer: Matthew Rocklin
7 Maintainer-email: [email protected]
8 License: BSD
9 Description: Caching for Analytic Computations
10 ---------------------------------
11
12 Humans repeat stuff. Caching helps.
13
14 Normal caching policies like LRU aren't well suited for analytic computations
15 where both the cost of recomputation and the cost of storage routinely vary by
16 one million or more. Consider the following computations
17
18 ```python
19 # Want this
20 np.std(x) # tiny result, costly to recompute
21
22 # Don't want this
23 np.transpose(x) # huge result, cheap to recompute
24 ```
25
26 Cachey tries to hold on to values that have the following characteristics
27
28 1. Expensive to recompute (in seconds)
29 2. Cheap to store (in bytes)
30 3. Frequently used
31 4. Recenty used
32
33 It accomplishes this by adding the following to each items score on each access
34
35 score += compute_time / num_bytes * (1 + eps) ** tick_time
36
37 For some small value of epsilon (which determines the memory halflife.) This
38 has units of inverse bandwidth, has exponential decay of old results and
39 roughly linear amplification of repeated results.
40
41 Example
42 -------
43
44 ```python
45 >>> from cachey import Cache
46 >>> c = Cache(1e9, 1) # 1 GB, cut off anything with cost 1 or less
47
48 >>> c.put('x', 'some value', cost=3)
49 >>> c.put('y', 'other value', cost=2)
50
51 >>> c.get('x')
52 'some value'
53 ```
54
55 This also has a `memoize` method
56
57 ```python
58 >>> memo_f = c.memoize(f)
59 ```
60
61 Status
62 ------
63
64 Cachey is new and not robust.
65
66 Platform: UNKNOWN
67 Classifier: Development Status :: 4 - Beta
68 Classifier: Intended Audience :: Developers
69 Classifier: Intended Audience :: Science/Research
70 Classifier: License :: OSI Approved :: BSD License
71 Classifier: Operating System :: OS Independent
72 Classifier: Programming Language :: Python :: 3
73 Classifier: Programming Language :: Python :: 3.6
74 Classifier: Programming Language :: Python :: 3.7
75 Classifier: Programming Language :: Python :: 3.8
76 Classifier: Topic :: Scientific/Engineering
77 Requires-Python: >=3.6
78 Description-Content-Type: text/markdown