-
-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to set template cache key #486
base: main
Are you sure you want to change the base?
Ability to set template cache key #486
Conversation
@SpeedyStuart, please fix the conflict |
@@ -15,7 +15,6 @@ namespace Fluid.ViewEngine | |||
public class FluidViewRenderer : IFluidViewRenderer | |||
{ | |||
private static readonly char[] PathSeparators = { '/', '\\' }; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
/// <summary> | ||
/// Represents the method that will generate a cache key for a supplied template path. Allows templates to be cached based on any external factor. | ||
/// </summary> | ||
public delegate string TemplateCacheKeyProviderDelegate(string path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it's a good idea to have a delegate, I'm thinking of providing another API for caching or using IMemoryCache
where the cache key could be provided by the user
This allows implementers to provide a delegate for generating the key that's used for template caching/retrieval. Therefore it allows templates to be cached based on something other than (just) their path + name.
Used with a custom file provider it allows different templates to be served based on arbitrary request properties - e.g. user-agent, cookie etc.
Possible solution for #470