Add caching with LRU cache under mutex
Caches responses of each GET handler in a separate capacity-limited cache (as a custom clone-able `CachedResponse` struct). Subsequent requests will build a `Response` from the cached bytes instead of re-querying the database and re-serializing the JSON. This greatly speeds up the list endpoints and `get_interior_ref_list`. Also caches the api-key-to-id mapping for `Owner`s in order to speed up frequent authentications. Each create handler clears the entire list response cache. Each delete handler also clears the entire list response cache and deletes the cached response for that key. Deleting an owner also deletes their entry in the `owner_ids_by_api_key` cache.
This commit is contained in:
9
test_data/shop2.json
Normal file
9
test_data/shop2.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "Test Shop",
|
||||
"owner_id": 2,
|
||||
"description": "for testing",
|
||||
"is_not_sell_buy": true,
|
||||
"sell_buy_list_id": 1,
|
||||
"vendor_id": 1,
|
||||
"vendor_gold": 0
|
||||
}
|
||||
Reference in New Issue
Block a user