warp-contracts / warp

An implementation of the Arweave SmartWeave smart contracts protocol.
MIT License
158 stars 44 forks source link

[FEATURE] - warp-contracts-redis for caching contract state #478

Closed dtfiedler closed 12 months ago

dtfiedler commented 1 year ago

Is your feature request related to a problem? Please describe. Unable to cache contract-state across multiple running containers (each has it's own local LevelDb or LMDB)

Describe the solution you'd like Similar to warp-contracts-lmdb - cache contract interaction and state usingredis

Describe alternatives you've considered N/A.

Additional context Gives clients the ability a shared redis cluster that can be used for state evaluation across various warp implementations.

ppedziwiatr commented 12 months ago

Hey, we currently have no plans for implementing Redis version - internally we're using postgres implementation - https://github.com/warp-contracts/warp-contracts-postgres - which you might consider as an alternative.

If you insist on Redis - we're happy to accept PRs :-) Simply implement the BasicSortKeyCache - as in the Postgres/Lmdb/LevelDb/Sqlite versions - e.g. https://github.com/warp-contracts/warp-contracts-postgres/blob/main/src/PgContractCache.ts#L14

I also believe that FirstBatch had their implementation in Redis - i.e. https://github.com/firstbatchxyz/warp-contracts-redis/blob/master/src/redisCache.ts - it implements SortKeyCache, which additionaly adds methods for the KV Storage.