navita icon indicating copy to clipboard operation
navita copied to clipboard

Clean up Engine's caching

Open Zn4rK opened this issue 2 months ago • 0 comments

As I almost mentioned in https://github.com/eagerpatch/navita/pull/43, the caching mechanism we're using right now, always assumes in-memory usage.

This works very well as it is right now, but the way the code is structured could be better. If we reach for a more flat structure, it would be easier to expand/replace to another type of persistent storage later. Right now we're also pretty inefficient in the way we are storing data for the cache

Here's an example entry:

"{\"type\":\"rule\",\"selector\":\"\",\"property\":\"padding\",\"value\":\"20px\",\"pseudo\":\"\",\"media\":\"\",\"support\":\"\",\"container\":\"\"}": {
  "id": "b1",
  "type": "rule",
  "selector": "",
  "property": "padding",
  "value": "20px",
  "pseudo": "",
  "media": "",
  "support": "",
  "container": ""
},

The key is the value, just stringified, and without the id.

Zn4rK avatar Apr 14 '24 10:04 Zn4rK