Skip to content
Discussion options

You must be logged in to vote

Hi @oasaleh

Should I use the property or the method? I can only find documentation for the property but not the method. Are they the same?

Yes they do the same thing. Why do they both exist?
Because the property is the actual thing that is used, whereas the method sets the property + returns the entry options themselves, for chaining purposes so you can compose multiple modifications together without having to create an explicit block of code, in a fluent api way.

For example when you do this:

var foo = cache.GetOrSet<Foo>(
  "foo",
  _ => GetFooFromDb(),
  options => options.SetSkipMemoryCacheWrite().SetFailSafe(true, TimeSpan.FromSeconds(10))
);

without the fluent api methods you need…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by oasaleh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants