File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,14 @@ import (
3434 "github.com/mailgun/groupcache/v2"
3535)
3636
37+ // A RefreshFS is a file system with a Refresh method.
38+ type RefreshFS interface {
39+ fs.FS
40+
41+ // Refresh refreshes a path in the filesystem.
42+ Refresh (ctx context.Context , path string ) error
43+ }
44+
3745// Config stores the configuration settings of your cache.
3846type Config struct {
3947 GroupName string // Name of the groupcache group
@@ -49,6 +57,9 @@ type cacheFS struct {
4957 cache * groupcache.Group
5058}
5159
60+ // Statically declare that cacheFS satisfies RefreshFS.
61+ var _ RefreshFS = (* cacheFS )(nil )
62+
5263// Open opens the named file.
5364//
5465// When Open returns an error, it should be of type *fs.PathError
@@ -176,3 +187,8 @@ func New(innerFS fs.FS, config *Config) fs.FS {
176187 })),
177188 }
178189}
190+
191+ // Refresh refreshes a path in the filesystem.
192+ func (c * cacheFS ) Refresh (ctx context.Context , path string ) error {
193+ return c .cache .Remove (ctx , path )
194+ }
You can’t perform that action at this time.
0 commit comments