cdp-cache icon indicating copy to clipboard operation
cdp-cache copied to clipboard

downloaded again after the service restarts

Open wusertu opened this issue 3 years ago • 3 comments

I have a problem with the same file being downloaded again after the service restarts

wusertu avatar Mar 09 '21 13:03 wusertu

@wusertu hi,

Well, I am sorry I don't understand what you mean. Could you please elaborate on it with an example? That will help me to understand what you've encountered.

sillygod avatar Mar 11 '21 13:03 sillygod

@sillygod Like this, request the file once to get the cache, then restart the caddy service and request the file again, then the same file is downloaded repeatedly

love4taylor@EGOIST:/data/caddy/cache/pximg$ ll -h
total 2.7M
drwxr-xr-x 2 root root  32K Jul 19 23:28 ./
drwxr-xr-x 3 root root 4.0K Jul 19 13:37 ../
-rw------- 1 root root 1.3M Jul 19 23:28 caddy-cache-855862080
-rw------- 1 root root 1.3M Jul 19 23:28 caddy-cache-966089272
love4taylor@EGOIST:/data/caddy/cache/pximg$ sudo sha256sum caddy-cache-*
b76b8760c4db809ed87b647eead9c8ad58a4daebd0e1e14c00412f9730dae689  caddy-cache-855862080
b76b8760c4db809ed87b647eead9c8ad58a4daebd0e1e14c00412f9730dae689  caddy-cache-966089272
love4taylor@EGOIST:/data/caddy/cache/pximg$

love4taylor avatar Jul 19 '21 23:07 love4taylor

oh, ok. This situation will happen when the cache type is set to file. I will fix this in my spare time. If you hurry, you may try to use an in-memory cache instead. here is the example settings.

sillygod avatar Jul 20 '21 08:07 sillygod

+1 to this issue.

The file system cache type is not managed after a caddy restart. The files remain on the filesystem, but are not taken into account by the cache - for example going to admin api curl -X GET localhost:2019/caches/ will return an empty response.

I see that the files themselves do not contain any information about the cache_key like nginx does.

I do commend you for:

  • list and purge api
  • custom cache key

I hope you do have a bit of time to fix this, it already looks really nice!

teodorescuserban avatar May 09 '24 06:05 teodorescuserban