Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/benfoster/cachecowdemo
A demo of using CacheCow in a hierarchical REST API.
https://github.com/benfoster/cachecowdemo
Last synced: about 1 month ago
JSON representation
A demo of using CacheCow in a hierarchical REST API.
- Host: GitHub
- URL: https://github.com/benfoster/cachecowdemo
- Owner: benfoster
- License: mit
- Created: 2013-11-07T16:35:01.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-11-07T16:39:43.000Z (about 11 years ago)
- Last Synced: 2023-03-23T22:01:16.748Z (over 1 year ago)
- Language: C#
- Size: 555 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# CacheCow Demo
Demonstrates using the [CacheCow ASP.NET Web API Caching Library](https://github.com/aliostad/CacheCow/) within a heirarchical REST API.
Specifically it ensures that caching works for related resources such that:
`POST /contacts` invalidates `/contacts`
`PUT /contacts/10` invalidates `/contacts/10, /contacts`
`POST /contacts/10/numbers` invalidates `/contacts/10/numbers, /contacts/10, /contacts`Although I'm not using it in the example the `LinkedRouteProvider` can be tweaked to set a maximum cache invalidation depth.
For example if you have quite a deep heirarchy you may want a POST to `/sites/10/contacts/10/numbers` to only invalidate up to `/sites/10/contacts` (not `/sites/10` or above).
This can be achieved by setting a max invalidation depth:Change:
return GetRelatedResources(path);
To:
// don't invalidate anything above the 3rd resource in the heirarchy
return GetRelatedResources(path, 3);## License
Licensed under the MIT License.