How to configure syscache's Region and Expiration using code (not in App.Config xml)

StackOverflow https://stackoverflow.com/questions/17279361

  •  01-06-2022
  •  | 
  •  

سؤال

I'm trying to configure NHibernate's 2nd level cache. I want to configure by code and not use xml configuration I've followed most of the tutorial but I can't seem to translate this xml configuration in code:

<syscache>
    <cache region="LongTerm" expiration="180" priority="5" />
    <cache region="ShortTerm" expiration="60" priority="3" />
</syscache>

How can I configure the syscache region and expiration settings using code?

هل كانت مفيدة؟

المحلول

Syscache gets the values from the application configuration file. It does not expose any configuration by code.

You can clone it from https://github.com/diegose/NHibernate.Diegose (non-authoritative, but up-to-date) and implement a code api yourself.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top