Closed jfmow closed 10 months ago
It will use custom route on pb go to access local redis instance to retrieve page and then verify in the stored json that the owner id is the auth user then send the content
Too expensive for this project and better method found.
Its only really for the session so instead were just using session storage using the same logic,
let record = await Cache.get(page)
if (!record || new Date(record?.updated) <= new Date(listedPageItems.find((Apage) => Apage.id === page)?.updated)) {
console.log('not from cache')
record = await pb.collection("pages").getOne(page);
Cache.set(record.id, JSON.stringify(record))
}
setEditorData(record.content);
...
It's around 1.4x-1.5x faster
Instead of storing the content just in the db use redis to store it. The key is the page id and value is the content. (Obv need permission checking) but now when a user requests a page they get the view table and then the redis cache and then check the updated for the cache against the view tables one and if the same or somehow newer use the cache else use the normal db copy