I'm going to use CacheManager for my .net project. The problem is that I can't find any examples of CacheManager.Memcached usage.
This is how I use it:
public class GlobalCache
{
private static ICacheManager<object> memcachedClient { get; set; }
private static readonly object locker = new object();
static GlobalCache()
{
if (memcachedClient == null)
{
lock (locker)
{
memcachedClient = CacheFactory.Build("memcached", settings => settings.WithMemcachedCacheHandle("memcached"));
}
}
}
}
Web.config:
<configuration>
<enyim.com>
<memcached protocol="Binary">
<servers>
<add address="127.0.0.1" port="11211" />
</servers>
</memcached>
</enyim.com>
<cache name="memcached">
<handle name="memcached"/>
</cache>
</configuration>
The error I have is: http://c2n.me/3hSHqvR.png - unknown section in web config.
If I remove all these sections, I have another runtime error: http://c2n.me/3hSI745.png - config error.
I tried to use settings.WithSystemRuntimeCacheHandle() instead of settings.WithMemcachedCacheHandle() and it works fine without any config sections. But in this case, my cache is cleared every time I restart my app. And what I want is - store cache in memcached storage, without any relation to my application.
So if you have some examples or small tutorial of how to use memcached with CacheManager - I will be much appreciated.
Thanks in advance!