Replace django-cacheops with django-redis

This commit is contained in:
jeremystretch
2021-07-07 20:35:59 -04:00
parent b6ec1d9aa7
commit d9e27b6a82
7 changed files with 33 additions and 103 deletions

View File

@@ -1,25 +0,0 @@
# Caching
NetBox supports database query caching using [django-cacheops](https://github.com/Suor/django-cacheops) and Redis. When a query is made, the results are cached in Redis for a short period of time, as defined by the [CACHE_TIMEOUT](../configuration/optional-settings.md#cache_timeout) parameter (15 minutes by default). Within that time, all recurrences of that specific query will return the pre-fetched results from the cache.
If a change is made to any of the objects returned by the query within that time, or if the timeout expires, the results are automatically invalidated and the next request for those results will be sent to the database.
## Invalidating Cached Data
Although caching is performed automatically and rarely requires administrative intervention, NetBox provides the `invalidate` management command to force invalidation of cached results. This command can reference a specific object by its type and numeric ID:
```no-highlight
$ python netbox/manage.py invalidate dcim.Device.34
```
Alternatively, it can also delete all cached results for an object type:
```no-highlight
$ python netbox/manage.py invalidate dcim.Device
```
Finally, calling it with the `all` argument will force invalidation of the entire cache database:
```no-highlight
$ python netbox/manage.py invalidate all
```

View File

@@ -52,14 +52,6 @@ BASE_PATH = 'netbox/'
---
## CACHE_TIMEOUT
Default: 900
The number of seconds that cache entries will be retained before expiring.
---
## CHANGELOG_RETENTION
Default: 90

View File

@@ -68,6 +68,10 @@ CustomValidator can also be subclassed to enforce more complex logic by overridi
* [#6338](https://github.com/netbox-community/netbox/issues/6338) - Decimal fields are no longer coerced to strings in REST API
* [#6639](https://github.com/netbox-community/netbox/issues/6639) - Drop support for queryset caching (django-cacheops)
### Configuration Changes
* The `CACHE_TIMEOUT` configuration parameter has been removed.
### REST API Changes
* Added the `/api/users/tokens/` endpoint