plone / guillotina

Python AsyncIO data API to manage billions of resources
https://guillotina.readthedocs.io/en/latest/
Other
187 stars 51 forks source link

Safer keys for memcached #1019

Closed lferran closed 3 years ago

lferran commented 3 years ago

What this PR does

Hashes cache keys before sending it to memcached, to avoid having keys that aren't valid.

Pros:

Cons:

prob_key_collision = 1.0 / 15**56
n_cache_keys = 10 * 2**30

prob_key_collision * n_cache_keys = ~ 1.5e-56
codecov-io commented 3 years ago

Codecov Report

Merging #1019 into 5.x will increase coverage by 0.1%. The diff coverage is 100.0%.

Impacted file tree graph

@@           Coverage Diff           @@
##             5.x   #1019     +/-   ##
=======================================
+ Coverage   94.7%   94.7%   +0.1%     
=======================================
  Files        296     296             
  Lines      27198   27219     +21     
=======================================
+ Hits       25750   25771     +21     
  Misses      1448    1448             
Impacted Files Coverage Δ
guillotina/contrib/memcached/driver.py 85.0% <100.0%> (+0.4%) :arrow_up:
...uillotina/tests/memcached/test_memcached_driver.py 100.0% <100.0%> (ø)
vangheem commented 3 years ago

5.3.58 released