1. Trang chủ
  2. » Công Nghệ Thông Tin

Using memcached cached provider 1 2

2 943 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 2
Dung lượng 123,1 KB

Nội dung

Using memcached cached provider 1 2

Using Memcached Cached Provider - Download Memcached Providers release and unzip it. - Download Memcached for win32 from http://jehiah.cz/projects/memcached-win32/ for version 1.2.1 and from http://www.splinedancer.com/memcached-win32/ for version 1.2.4. (This version supports multiple Get method). - Create a new ASP.net Web Application Project. - Right mouse click on the references folder in the project and click on “Add Reference” option. Go to the location where Memcached Providers were unzip and select Enyim.Cache.dll, MemcachedProviders.dll & Log4net.dll. Then click “OK” to add them to the project. - Open Web.config file and add the following section to configSections tag <section name="cacheProvider" type="MemcachedProviders.Cache.CacheProviderSection, MemcachedProviders" allowDefinition="MachineToApplication" restartOnExternalChanges="true"/> <sectionGroup name="enyim.com"> <section name="memcached" type="Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching" /> </sectionGroup> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/> This document is provided under the “Apache License Version 2.0, January 2004” http://www.apache.org/licenses/ 1 - Add the following section to configure Enyim’s client to point to Memcached servers <enyim.com> <memcached> <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> - Add the following section to configure Memcached Cache Provider. keySuffix attribute allows for adding suffix to cache provider keys in order to simulate namespaces. <cacheProvider defaultProvider="MemcachedCacheProvider"> <providers> <add name="MemcachedCacheProvider" type="MemcachedProviders.Cache.MemcachedCacheProvider, MemcachedProviders" keySuffix="_MySuffix_" defaultExpireTime="2000"/> </providers> </cacheProvider> - Add following section to configure log4net <log4net> <!-- Define some output appenders --> <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender"> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" /> </layout> </appender> <!--<threshold value="OFF" />--> <!-- Setup the root category, add the appenders and set the default priority --> <root> <priority value="WARN"/> <appender-ref ref="ConsoleAppender"> <filter type="log4net.Filter.LevelRangeFilter"> <levelMin value="WARN"/> <levelMax value="FATAL"/> </filter> </appender-ref> </root> </log4net> - Add a new aspx page to the project. - Switch to code view and add the following line of code. using MemcachedProviders.Cache; - Now to add an item to memcached write the following line to code DistCache.Add(strKey, objValue); - To get that item back write the following line of code DistCache.Get(strKey); This document is provided under the “Apache License Version 2.0, January 2004” http://www.apache.org/licenses/ 2 . Using Memcached Cached Provider - Download Memcached Providers release and unzip it. - Download Memcached for win 32 from http://jehiah.cz/projects /memcached- win 32/ . defaultProvider="MemcachedCacheProvider"> <providers> <add name="MemcachedCacheProvider" type="MemcachedProviders.Cache.MemcachedCacheProvider,

Ngày đăng: 30/05/2013, 11:38

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN

w