What is memcached? Use memcached to speed up the server system

Memcached is originally a Linux application, but because Memcached is open source, it has been developed by developers for the Windows platform.

Activity diagram:

screen-shot-2016-12-16-at-10-41-50-am

  • Memcache activity diagram
    • First request: accessing the database, the server will return the result
    • User as usual today
    • And one more thing is to pay data into memcached.
  • Next requests:
    • Accessing it will not require the server to work anymore; instead it will return the memcached word to the user
    • That will help minimize the amount of work the server needs to work. Help your website run about 70% faster
  • Advantages :
    • At a small level people often use memcached to store shared data, usually saving sessions. This is most convenient in simple loadbalancing types like nginx or pound, without having to worry about persistence sessions.
    • At a slightly larger level, people use memcached to minimize read from db, for data that is less variable and needs to be calculated, the query is complex and resource-consuming.
    • Installable environment: Windows, Linux
  • Defect :
    • Memcached has no mechanism to verify the accuracy of data stored in it. This may see too much system structure (memcached does not have any contact with db, but is independent).
    • To use it, you must install memcached on the server.
    • Not automatically synchronized with database data when data changes. For example: Database with data A and Memcached also has data A. When database changes value to B, memcached is still A. Can you refer to reducing legal use Sqlcachedependency

How to install memcached in Windows.

Download: memcached-win32-1.4.4-14.zip

Unzip and copy to some folder on your hard drive (eg C: memcached)

Open the command line into the directory containing memcached and type memcached.exe -d install

Let start memcached server type: memcached.exe -d start

By default, the port of the memcached server is 11211

So the installation is complete.

Use C # to connect to Memcached

Use dll with nuget: Install-Package EnyimMemcached -Version 2.13.0

Use C # to connect to Memcached

result

screen-shot-2016-12-16-at-10-43-04-am

demo Use C # to connect to Memcached

screen-shot-2016-12-16-at-10-43-26-am

Another type of Cache is similar to Memcached

  • IIS Cache
  • Memory Cache
  • Redis
  • Disk
  • NCache
  • Sqlcachedependency
  • … ..

ITZone via Kipalog

Share the news now