diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-12-06 17:53:57 -0800 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-12-06 17:53:57 -0800 |
commit | f2fc4db1ea0dbf4a1f75fb3e52b64e6f529e5e44 (patch) | |
tree | 7883ac215fd18966b8a1919c24339ec430bddac3 /system/db/content.go | |
parent | 64050ef8065bccdef0aab1748040995c637fe9ed (diff) |
adding cache (client-based, Etag) to API responses in addition to static files uploaded
Diffstat (limited to 'system/db/content.go')
-rw-r--r-- | system/db/content.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/system/db/content.go b/system/db/content.go index 74a77ec..19c31d7 100644 --- a/system/db/content.go +++ b/system/db/content.go @@ -77,6 +77,12 @@ func update(ns, id string, data url.Values) (int, error) { go SortContent(ns) } + // update changes data, so invalidate client caching + err = InvalidateCache() + if err != nil { + return 0, err + } + return cid, nil } @@ -132,6 +138,12 @@ func insert(ns string, data url.Values) (int, error) { go SortContent(ns) } + // insert changes data, so invalidate client caching + err = InvalidateCache() + if err != nil { + return 0, err + } + return effectedID, nil } @@ -149,6 +161,12 @@ func DeleteContent(target string) error { return err } + // delete changes data, so invalidate client caching + err = InvalidateCache() + if err != nil { + return err + } + // exception to typical "run in goroutine" pattern: // we want to have an updated admin view as soon as this is deleted, so // in some cases, the delete and redirect is faster than the sort, |