whitfin / cachex

A powerful caching library for Elixir with support for transactions, fallbacks and expirations
https://hexdocs.pm/cachex/
MIT License
1.6k stars 103 forks source link

Refactor save/restore functions and disk internals #369

Closed whitfin closed 1 month ago

whitfin commented 1 month ago

This fixes #365.

This PR will replace Cachex.dump/3 and Cachex.load/3 with Cachex.save/3 and Cachex.restore/3. At the same time all internals have been rewritten to provide a more memory efficient implementation when possible, with a focus on streaming. The Cachex.export/2 function has also been modified to use Cachex.stream/3. Due to all of these changes, Cachex.Disk has also been completely removed.

Compression has been removed as an option, instead using Elixir's GZIP compression directly. The :trusted option has been renamed to :trust, even though I imagine people aren't setting this directly.

This PR also fixes a couple of bugs inside option parsing as well as streams.