Memcache installation under Windows7

Source: Internet
Author: User

1. Download the package:

Download package download memercached for windows:http://download.csdn.net/detail/bbirdsky/7395123

2. Installation:

2.1, extract to the specified directory, such as: E:\memcached

2.2, open the command window with CMD, go to the extracted directory, enter "memcached-d install" such as:

2.3, check whether the installation is successful, enter the Memcached–h, the window description has been installed successfully.

Default parameter Description-p listens on port-L connection IP address, default is native-D-Start memcached service-D Restart Restart memcached service-D Stop|shutdown Close running MEMC ached Service-D install memcached service-D Uninstall Uninstall memcached-U Run as (only valid when running as root-m maximum memory usage, in MB. The default 64m-m memory is exhausted when the error is returned, instead of removing the-c maximum number of simultaneous connections, the default is the 102-F block size growth factor, default is 1.2-n minimum allocation space, key+value+flags default is 4-h display Help

3. Start/Stop

memcached.exe-d start

Memcached.exe-d stop

memcached.exe-d restart

4. Testing

4.1 Telnet test is working correctly telnet 127.0.0.1 11

4.2 After entering, press CTRL +] to start the callback function, otherwise you cannot see the input information. The callback function starts successfully as follows:

4.3 Stats command to view the running status such as:

5. Download Java Link driver:

Https://github.com/gwhalin/Memcached-Java-Client/downloads

6. Write the code:

Package Org.aning.blog.engine.base.service.impl;import Java.util.calendar;import Java.util.date;import Org.aning.blog.engine.base.service.imemcacheservice;import Com.danga.memcached.memcachedclient;import Com.danga.memcached.sockiopool;public class Memcacheservice implements Imemcacheservice {//build cache client private static Me        Mcachedclient cachedclient;          Private Memcacheservice () {cachedclient = new memcachedclient ();            Get connection Pool instance Sockiopool pool = sockiopool.getinstance ();                    Setting the cache server address allows you to set multiple implementations of distributed cache 11211 Pool.setservers (new string[]{"127.0.0.1:11211"});          Set initial connection 5 pool.setinitconn (5);          Set the minimum connection 5 pool.setminconn (5);          Set maximum connection of Pool.setmaxconn (250);            Set maximum idle time per connection 3 hours pool.setmaxidle (1000 * 60 * 60 * 3);            Pool.setmaintsleep (30);          Pool.setnagle (FALSE);          Pool.setsocketto (3000);          Pool.setsocketconnectto (0); Pool.initiAlize ();        } public static void Main (string[] args) {memcacheservice mem= new Memcacheservice ();    Date date = new Date ();    Calendar C = calendar.getinstance ();    C.settime (date);    C.add (Calendar.second, 2);    Date = C.gettime ();        Mem.add ("Test", "yeah!", date);    System.out.println ("--------------------------");    System.out.println (Mem.get ("Test"));    for (int i = 0; i < 5; i++) {System.out.println (i + "-----------");    try{Thread.Sleep (1000);    }catch (Exception e) {}} System.out.println ("--------------------------");            System.out.println (Mem.get ("Test"));      @Override public void Add (String key, Object value) {Cachedclient.set (key, value); } @Override public void Add (String key, Object value, int milliseconds) {Cachedclient.set (key, value      , milliseconds); } public void Add (String key, Object value, date date) {Cachedclient.set (key, ValuE, date);      } @Override public void Remove (String key) {cachedclient.delete (key); } @SuppressWarnings ("deprecation") @Override public void Remove (String key, int milliseconds) {Cached      Client.delete (key, milliseconds, new Date ()); } @Override public void update (String key, Object value, int milliseconds) {Cachedclient.replace (key      , value, milliseconds);      } @Override public void update (String key, Object value) {cachedclient.replace (key, value);      } @Override public Object get (String key) {return cachedclient.get (key); }  }

problems you may encounter :

Question one: http://www.cnblogs.com/javawebsoa/p/3211968.html

Solution for Windows 7 memcached failed to install service or service already installed

Today's whim to tinker with Memcache, because the system is Windows 7, I refer to Windows under Install Memcache using memcached for Win32.
An error was reported while running memcached.exe-d install, failed to install service or service already installed.
Conjecture may be a permission problem, after all, is to install as a service, so will cmd.exe as an administrator to run, success.
The way to run as an administrator is to find Cmd.exe under c:/windows/system32/, and then right-click "Run as Administrator".

After running, start, you can find a service process such as Memcached server in Task Manager's service, then you can test it.

Off-topic, really get the program to do software also have to Linux.

Also be sure to note the Php-memcache.dll or Php-memcached.dll and PHP version of the corresponding relationship, if the version does not correspond to the load.

Question two: http://www.cnblogs.com/haitao-fan/p/3912358.html

Modify the port number of the Memcached service under Windows

Although memcached load Linux more people, but still someone to load on windows, such as our company.

Although the memcached default port number is good, but someone wants to change its port number, such as me.

If you do not start memcached as a service, the MEMCACHED-P port number will do.

But as a service, how to change it?

Memcached-p 15000-d Start//Doing so is not valid

Here I am implementing by modifying the registry

hkey_local_machine\system\currentcontrolset\services\memcached server where the value of the ImagePath entry is: "c:\memcached\ Memcached.exe "-D Runservice changed to:" C:\memcached\memcached.exe "-P 15000-d Runservice

Resources:

Http://www.ccvita.com/258.html

http://blog.csdn.net/wxwzy738/article/details/8571428

Http://www.360doc.com/content/11/0516/12/1039473_117157506.shtml

Http://jingyan.baidu.com/article/ed2a5d1f257fe509f6be178a.html

Memcache installation under Windows7

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.