Skip to content

Commit

Permalink
Update CACHING.md
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-scherbina authored Oct 17, 2023
1 parent b9c6ac7 commit b40c7df
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions architecture/CACHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,36 @@ package provides two different middlewares:

## Cache Invalidation

### Keys Structure

Keys have such format:

`query:<chain_name>:<method_name>:<keccak256(body)>`

For example:

`query:local-chain:eth_getBlockByNumber:0x72806e50da4f1c824b9d5a74ce9d76ac4db72e4da049802d1d6f2de3fda73e10`

### Invalidation for specific method

If you want to invalidate cache for specific method you may run such command:

`redis-cli KEYS "query:<chain_name>:<method_name>:*" | xargs redis-cli DEL`

For example:

`redis-cli KEYS "query:local-chain:eth_getBlockByNumber:*" | xargs redis-cli DEL`

### Invalidation for all methods

If you want to invalidate cache for all methods you may run such command:

`redis-cli KEYS "query:<chain_name>:*" | xargs redis-cli DEL`

For example:

`redis-cli KEYS "query:local-chain:*" | xargs redis-cli DEL`

## Architecture Diagrams

### Serve request from the cache (avoiding call to actual backend)
Expand Down

0 comments on commit b40c7df

Please sign in to comment.