Communifire, based on Provider Design pattern, lets you use any caching model of your choice without changing even a single line of core source code. By default Communifire uses built-in ASP.NET cache object, but it supports distributed caching like Redis and memcached when hosting in a load balanced environment.
Please use your own Redis or memcached provider by downloading the latest versions your favorite .NET clients of these caching tools. The example give below is just to show how you can use the default redis or memcached provider and how you can install the current latest versions (at the time of writing this wiki), but we strongly recommend that you make sure you download the latest versions of these tools and create your own DLL.
Communifire comes a default version of Redis client which uses the free StackExchange.Redis client. Here are the steps the configure the Redis client:
1. Download and install the latest redis server on your Windows Server which you want to use for distributed caching. Here is the link for 3.2.100 version which was the latest stable release at the time of writing this guide: Redis-x64-3.2.100.msi
2. Configure Communifire to use Redis by editing CFProviders.config file (in your root Communifire installation folder) as follows:
<CacheProvider defaultProvider="CFRedisCacheProvider"> <providers> <add name="CFRedisCacheProvider" type="Communifire.Caching.Redis.CFRedisCacheProvider,Communifire.Caching.Redis" /> </providers> </CacheProvider>
3. Go to Communifire admin section, select System > System Properties and then select Redis Config category from the left side pane. You will see SignalR-Redis specific settings, you need to edit and put the right values (the below example uses sample values):
"RedisServerCSV"=10.10.1.11:6379"UseRedisForSignalR" value="true""RedisServerNameForSignalR" value="10.10.1.11" --your IP for redis server goes here"RedisServerPassword" value=xxxx"RedisServerPortForSignalR" value="6379"
Multiple Redis servers can be added, for example:
4. Set the "IsRedisEnabled" setting to true in Control Panel > System > System Properties (/admin/settings/manage-system-properties):
/CFAppSettings-Overrides.config
<?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <!-- Add your keys here. You can copy default key/values from CFAppSettings.config file and modify them here. You can also add new key/value pairs. --> <add key="RunBackgroundJobs" value="true"/> <add key="IsRedisEnabled" value="true"/> </appSettings> </configuration>
5. In order to allow remote connections for Redis server, you need to modify redis.windows-service.conf file and add machine ip in "bind ip" section:
Restart the Redis server and webservers once the above step is completed.
If you want to "monitor" the Redis you can follow: http://redis.io/commands/MONITOR
MONITOR is a debugging command that streams back every command processed by the Redis server. It can help in understanding what is happening to the database.
If you want to log the monitor command output to a text file, you can run this:
redis-cli -h 10.50.10.48 monitor > C:\GitProjects\Communifire70\Communifire.Web\Assets\Uploaded-CMS-Files\logs\redis_log.txt
After installing Redis you can run the following command over "C:\Program Files\Redis" directory (or the location where you installed Redis):redis-benchmark.exe -t set,get
to check whether your server is giving the following expected results:
We recommend using Redis for distributed caching in Communifire. But you can use memcached too. To enable support for memcached in Communifire, follow these steps.
First download and install memcached win32 version by clicking here or win64 version by clicking here. Though you can work with the Windows port of memcached, we recommend using the Linux port as that is more stable.
To install memcached as a service, follow the next steps :
SC create memcached binpath= "c:\memcached\memcached.exe -m 1024 -d" start= "auto"
NET START memcached
After Memcached has been installed on your server, follow these instructions:
<sectionGroup name="enyim.com"> <section name="memcached" type="Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching" /> </sectionGroup> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
<enyim.com> <memcached protocol="Binary"> <servers> <!-- put your own server(s) here--> <add address="127.0.0.1" port="11211" /> </servers> <socketPool minPoolSize="10" maxPoolSize="100" connectionTimeout="00:00:10" deadTimeout="00:02:00" /> </memcached> </enyim.com>
<CacheProvider defaultProvider="CFDefaultCacheProvider"> <providers> <add name="CFDefaultCacheProvider" type="Communifire.Caching.CFDefaultCacheProvider,Communifire.Caching" /> </providers> </CacheProvider>
<CacheProvider defaultProvider="CFMemCacheProvider"> <providers> <add name="CFMemCacheProvider" type="Communifire.Caching.MemCached.CFMemCacheProvider,Communifire.Caching.MemCached" /> </providers></CacheProvider>
Now your application is ready to use memcached instead of using ASP.NET Cache. To make sure no firewall rule is blocking the memcached access from another server, you should attempt to connect with telnet to memcahed.
telnet 127.0.0.1 11211
You have to use the memcached network IP instead of 127.0.0.1 (change the port too in case memcached is running on another port instead of the default 11211). If you can't telnet to it then your setup is bad or you might have some firewall blocking it.Reference:
http://blog.elijaa.org/index.php?post/2010/10/15/Memcached-for-Windows&similarhttp://blog.elijaa.org/index.php?post/2010/08/25/Memcached-1.4.5-for-Windows
https://github.com/enyim/EnyimMemcached/wiki
is requesting access to a wiki that you have locked: https://my.axerosolutions.com/spaces/5/communifire-documentation/wiki/view/704/distributed-cache-providers
Your session has expired. You are being logged out.