unstorage icon indicating copy to clipboard operation
unstorage copied to clipboard

feat: add `memcached` driver

Open Sanicboi opened this issue 3 years ago • 2 comments

Added memcached support. Had to change some functions and types due to the fact that they are not supported by memcached. For instance, memcached does not support getKeys.

Sanicboi avatar Oct 26 '22 15:10 Sanicboi

@Sanicboi Thanks for the PR !

@pi0 Memcached does not supports getKeys. I tried implementing with cachedump, but it wasn't reliable. We could manually implement a custom solution to keep track of all the keys set with setItem (underneath a custom key). But that would deserve a separated PR as its not as straightforward as it sounds.

If there's demand for it, we can definitely do it in a later. I've implemented a way to skip the getKeys test for one driver, but we could disable them all for memcached as most of them use getKeys underneath.

Also, the tests needs memcached to run, so I added that to the ci.

The docs clearly reflects that getKeys doesn't work with memcached, so I think it's fine.

Hebilicious avatar Jul 02 '23 21:07 Hebilicious

Codecov Report

Merging #92 (756d3c3) into main (0e6e023) will decrease coverage by 1.12%. Report is 1 commits behind head on main. The diff coverage is 97.61%.

:exclamation: Current head 756d3c3 differs from pull request most recent head 66c856a. Consider uploading reports for the commit 66c856a to get more accurate results

@@            Coverage Diff             @@
##             main      #92      +/-   ##
==========================================
- Coverage   76.94%   75.82%   -1.12%     
==========================================
  Files          26       25       -1     
  Lines        3223     2809     -414     
  Branches      473      426      -47     
==========================================
- Hits         2480     2130     -350     
+ Misses        742      678      -64     
  Partials        1        1              
Files Changed Coverage Δ
src/drivers/memcached.ts 97.61% <97.61%> (ø)

... and 8 files with indirect coverage changes

codecov[bot] avatar Jul 02 '23 22:07 codecov[bot]