日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

[转]Installing Memcached on Windows

發布時間:2023/12/10 windows 53 豆豆
生活随笔 收集整理的這篇文章主要介紹了 [转]Installing Memcached on Windows 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Installing Memcached on Windows

原文鏈接https://commaster.net/content/installing-memcached-windows Submitted by?COMMASTER

Memcached is a high performance, in-memory key-value store or caching system. Its main purpose is to speed up web applications by caching database queries, contents, or other computed results.

Memcached is originally a linux application, but since it is open-source, it has been compiled for windows. There are two major sources for the pre-built windows binary: Jellycan and Northscale, and both versions can be used. The following are the download links for the memcached windows binaries:

http://code.jellycan.com/files/memcached-1.2.5-win32-bin.zip
http://code.jellycan.com/files/memcached-1.2.6-win32-bin.zip
http://downloads.northscale.com/memcached-win32-1.4.4-14.zip
http://downloads.northscale.com/memcached-win64-1.4.4-14.zip
http://downloads.northscale.com/memcached-1.4.5-x86.zip
http://downloads.northscale.com/memcached-1.4.5-amd64.zip

In versions earlier than 1.4.5, memcached can install itself as a service. However, the ability to run memcached as a service is removed since version 1.4.5. Therefore, the installation steps are divided into two categories, part A for memcached prior to version 1.4.5. and part B for memcached version 1.4.5 and later.

A) Installation of memcached < 1.4.5:

  • Extract the memcached windows binary to any directory.
  • In versions earlier than 1.4.5, memcached can install itself as a service. Run a command prompt with?elevated privileges, and type:
    c:\memcached\memcached.exe -d install

    * Replace?c:\memcached\memcached.exe?with the actual path of your installation.

  • Then, start or stop the memcached service with the following command:
    c:\memcached\memcached.exe -d start c:\memcached\memcached.exe -d stop
  • To change the configuration of memcached, run?regedit.exe?and navigate to the key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\memcached". Suppose you wish to increase the memory limit of memcached, edit the value of?ImagePath?to the following:
    "c:\memcached\memcached.exe" -d runservice -m 512

    * Besides '-m 512', you may also append other memcached parameters to the path. Run "c:\memcached\memcached.exe -h" to view the list of available parameters.

  • Meanwhile, to uninstall the memcached serivce, run the following command:
    c:\memcached\memcached.exe -d uninstall
  • B) Installation of memcached >= 1.4.5:

  • Extract the memcached windows binary to any directory.
  • In version 1.4.5 or later, memcached cannot run as a service. It must be started as a normal process using the task scheduler. To configure the memcached process to run automatically every time windows start, run a command prompt with?elevated privileges, and type the following:
    schtasks /create /sc onstart /tn memcached /tr "'c:\memcached\memcached.exe' -m 512"

    * Replace?c:\memcached\memcached.exe?with the actual path of your installation.
    ** Besides '-m 512', you may also append other memcached parameters to the path. Run "c:\memcached\memcached.exe -h" to view the list of available parameters.

  • Meanwhile, to remove the scheduled memcached task, run the following command:
    schtasks /delete /tn memcached
  • ?

    Integrating with PHP

    To interface with memcached in PHP, you need to install the memcache extension for PHP:

  • Check that your PHP extension folder has the file php_memcache.dll. If not, download the file from?https://pecl.php.net/package/memcache?(select the windows dll file), and place it in the PHP extension folder.
  • Add the following line in php.ini to enable the memcache extension.
    extension=php_memcache.dll
  • Create this simple php script file to test that it works.
    <?php$memcache = new Memcache; $memcache->connect('localhost', 11211) or die ("Could not connect");$version = $memcache->getVersion(); echo "Server's version: ".$version."<br/>\n";$tmp_object = new stdClass; $tmp_object->str_attr = 'test'; $tmp_object->int_attr = 123;$memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server"); echo "Store data in the cache (data will expire in 10 seconds)<br/>\n";$get_result = $memcache->get('key'); echo "Data from the cache:<br/>\n";var_dump($get_result);?>
  • Integrating with Python

    To interface with memcached in Python, you need to install the memcached client for Python.

  • Execute one of the following command to install the memcached client. The first is for Python 2.x while the second is for Python 3.x.
    pip install python-memcached pip install python3-memcached
  • Create this simple python script to test that it works.
    import memcache mc = memcache.Client(['127.0.0.1:11211'], debug=0) mc.set("some_key", "Some value") value = mc.get("some_key") mc.set("another_key", 3) mc.delete("another_key") mc.set("key", "1") ? # note that the key used for incr/decr must be a string. mc.incr("key") mc.decr("key")
  • Memcached statistics

    To view the statistics for memcached, bring up a telnet connection to memcached by the command:

    telnet 127.0.0.1 11211

    Then, type?stats?and enter.

    Here is an explanation of the different memcached stats.

    NameTypeMeaningNameTypeMeaning
    pid32uProcess id of this server process
    uptime32uNumber of secs since the server started
    time32ucurrent UNIX time according to the server
    versionstringVersion string of this server
    pointer_size32Default size of pointers on the host OS (generally 32 or 64)
    rusage_user32u.32uAccumulated user time for this process (seconds:microseconds)
    rusage_system32u.32uAccumulated system time for this process (seconds:microseconds)
    curr_items32uCurrent number of items stored
    total_items32uTotal number of items stored since the server started
    bytes64uCurrent number of bytes used to store items
    curr_connections32uNumber of open connections
    total_connections32uTotal number of connections opened since the server started running
    connection_structures32uNumber of connection structures allocated by the server
    reserved_fds32uNumber of misc fds used internally
    cmd_get64uCumulative number of retrieval reqs
    cmd_set64uCumulative number of storage reqs
    cmd_flush64uCumulative number of flush reqs
    cmd_touch64uCumulative number of touch reqs
    get_hits64uNumber of keys that have been requested and found present
    get_misses64uNumber of items that have been requested and not found
    delete_misses64uNumber of deletions reqs for missing keys
    delete_hits64uNumber of deletion reqs resulting in an item being removed.
    incr_misses64uNumber of incr reqs against missing keys.
    incr_hits64uNumber of successful incr reqs.
    decr_misses64uNumber of decr reqs against missing keys.
    decr_hits64uNumber of successful decr reqs.
    cas_misses64uNumber of CAS reqs against missing keys.
    cas_hits64uNumber of successful CAS reqs.
    cas_badval64uNumber of CAS reqs for which a key was found, but the CAS value did not match.
    touch_hits64uNumer of keys that have been touched with a new expiration time
    touch_misses64uNumer of items that have been touched and not found
    auth_cmds64uNumber of authentication commands handled, success or failure.
    auth_errors64uNumber of failed authentications.
    evictions64uNumber of valid items removed from cache to free memory for new items
    reclaimed64uNumber of times an entry was stored using memory from an expired entry
    bytes_read64uTotal number of bytes read by this server from network
    bytes_written64uTotal number of bytes sent by this server to network
    limit_maxbytes32uNumber of bytes this server is allowed to use for storage.
    threads32uNumber of worker threads requested. (see doc/threads.txt)
    conn_yields64uNumber of times any connection yielded to another due to hitting the -R limit.
    hash_power_level32uCurrent size multiplier for hash table
    hash_bytes64uBytes currently used by hash tables
    hash_is_expandingboolIndicates if the hash table is being grown to a new size
    expired_unfetched64uItems pulled from LRU that were never touched by get/incr/append/etc before expiring
    evicted_unfetched64uItems evicted from LRU that were never touched by get/incr/append/etc.
    slab_reassign_runningboolIf a slab page is being moved
    slabs_moved64uTotal slab pages moved
    crawler_reclaimed64uTotal items freed by LRU Crawler
    lrutail_reflocked64uTimes LRU tail was found with active ref. Items moved to head to avoid OOM errors.

    Source:?https://github.com/memcached/memcached/blob/master/doc/protocol.txt

    ?

    另,stackoverflow:

    http://stackoverflow.com/questions/8896/can-i-get-memcached-running-on-a-windows-x64-64bit-environment

    North Scale labs have released a build of memcached 1.4.4 for Windows x64:

    http://blog.couchbase.com/memcached-windows-64-bit-pre-release-available

    http://labs.northscale.com/memcached-packages/

    UPDATE: they have recently released Memcached Server - still FREE but enhanced distro with clustering, web-based admin/stats UI etc. (I'm not related to them in any way) Check it out at?http://northscale.com/products/memcached.html?and download at:?http://www.northscale.com/download.php?a=d

    UPDATE 2: NorthScale Memcached is no longer available as a standalone download. Now they have made it part of their commercial No-SQL DB offering called Membase. It can be configured to run in Memcached-only mode (i.e. without persistence) and there's a 100% free version too. Check it out here:?http://www.membase.org/downloads

    UPDATE 3: MemBase has slept with CouchDB and produced a hybrid product offering, called CouchBase. They still do offer a free "Community" version at?http://www.couchbase.com/download

    轉載于:https://www.cnblogs.com/mrtiny/p/installing-memcached-windows.html

    總結

    以上是生活随笔為你收集整理的[转]Installing Memcached on Windows的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。