SlideShare uma empresa Scribd logo
1 de 49
About Memcached
          E-mail   lcycenter@gmail.com
Memcached?
Memcached                     LiveJournal
                                            ,              ,
                        ,          Web


LiveJournal                 Memcached MogileFS   Perlbal



              : http://www.danga.com/memcached
?
?
Cache


Do one thing well
Map
key1: value1
key2:value2
key3:value3



                 Cache


 Do one thing well
Map
key1: value1
key2:value2    /
key3:value3



                   Cache


 Do one thing well
Map
key1: value1
key2:value2    /   Expired
key3:value3



                             Cache


 Do one thing well
Map
key1: value1
key2:value2              /            Expired
key3:value3



                                                Cache


 Do one thing well

                    I am not...
                      persistent
               failover / redundant
                   authentication
                      RDBMS...
Simple

•   C/S

•   support telnet interface

•
    ✴set / get / stats
Simple

•   C/S

•   support telnet interface

•
    ✴set / get / stats
Simple

•   C/S

•   support telnet interface

•
    ✴set / get / stats
Simple

•   C/S

•   support telnet interface

•
    ✴set / get / stats
Object getFoo(String fooId) {
    Object foo = memcached.get("foo" + fooId);
    if (foo != null) return foo;


    foo = database.fetchFoo(fooId);
    memcached.set("foo"+fooId, foo);
    return foo;
}
Base Patten
any problem?




Base Patten
Prefetch Patten
any problem?




Prefetch Patten
if (memcached.get(key) == null) {
  if (memcached.add(key_mutex, 3*60*1000) == true) {
    foo = database.fetchFoo(key);
    memcached.set(key, foo);
    memcached.delete(key_mutex);
  } else {
    sleep(50);
    retry();
  }
}


             Mutex Patten
Mutex Patten
any problem?




Mutex Patten
foo = memcached.get(key);
if (foo == null) {
    if (memcached.add(key_mutex, 3 * 60 * 1000) == true) {
        foo = database.get(key);

        memcached.set(key, foo);
        memcached.delete(key_mutex);
     } else {
        sleep(50);
        retry();
     }
} else {
  ...
}

              Mutex Patten II
foo = memcached.get(key);
if (foo == null) {
    if (memcached.add(key_mutex, 3 * 60 * 1000) == true) {
        foo = database.get(key);

        memcached.set(key, foo);
        memcached.delete(key_mutex);
     } else {
        sleep(50);
        retry();
     }
} else {
  ...        here
}

              Mutex Patten II
if (foo.timeout >= now()) {
    if (memcached.add(key_mutex, 3 * 60 * 1000) == true) {
        foo.timeout += 3 * 60 * 1000;
        memcached.set(key, foo, KEY_TIMEOUT * 2);
      foo = database.get(key);
      foo.timeout = KEY_TIMEOUT;
      memcached.set(key, foo, KEY_TIMEOUT * 2);
      memcached.delete(key_mutex);
   } else {
      sleep(50);
      retry();
   }
} else {
  return foo;
}

             Mutex Patten II
if (foo.timeout >= now()) {
    if (memcached.add(key_mutex, 3 * 60 * 1000) == true) {
        foo.timeout += 3 * 60 * 1000;
        memcached.set(key, foo, KEY_TIMEOUT * 2);
      foo = database.get(key);
      foo.timeout = KEY_TIMEOUT;
      memcached.set(key, foo, KEY_TIMEOUT * 2);
      memcached.delete(key_mutex);
   } else {
      sleep(50);
      retry();
   }
} else {
  return foo;
}

             Mutex Patten II
Mutex Patten II
any problem?




Mutex Patten II
?

       WEB          EJB       RDBMS



HTML         Marshall
                           SQL
JSON          Java
                          Results
 XML         Objects
?

       WEB          EJB       RDBMS



HTML         Marshall
                           SQL
JSON          Java
                          Results
 XML         Objects
?

       WEB          EJB       RDBMS



HTML         Marshall
                           SQL
JSON          Java
                          Results
 XML         Objects
•                   (memcached exptimes)

•
    -   SET or DELETE
    -
•        version

    -    version key: user_v2_100

    -              + LRU
Distribute Memcached
• MC HASH
• MC          Fail-over

 • MC-MC
 • DB-MC                  fail

 • Key-Value DB
MC Hash
•
    -   MC


•             Hash



    -
    -
    -
•
idx = Zlib.crc32(key) % servers.size




   Consistent Hashing
Consistent Hashing
Consistent Hashing
Others
•
• hot keys
  • create local cache
  • alias key
•
Memcached Client
•   Marshall

•
•   Multiget support
•   Compressed support
•   Async/Sync Modes
•   Replicated
•   ...
Stats


•         Memcached:

    •   telnet


•                : stats
Stats
Limits

• Key Size (250 bytes)
• Data Size (under 1 megabyte)
• 32bit/64bit (maximum size of the process)
Protocol Commands

• set / get / gets / replace / add / delete
• append / prepend
• increment / decrement
• cas (compare and swap atomic!)
• stats(detail)
Numbers Everyone
           Should Know
L1 cache reference                              0.5 ns
Branch mispredict                                 5 ns
L2 cache reference                                7 ns
Mutex lock/unlock                               100 ns
Main memory reference *                         100 ns
Compress 1K bytes with Zippy                 10,000 ns
Send 2K bytes over 1 Gbps network *          20,000 ns
Read 1 MB sequentially from memory *        250,000 ns
Round trip within same datacenter           500,000 ns
Disk seek *                              10,000,000 ns
Read 1 MB sequentially from network *    10,000,000 ns
Read 1 MB sequentially from disk *       30,000,000 ns
Send packet CA->Netherlands->CA         150,000,000 ns

Mais conteúdo relacionado

Mais procurados

glance replicator
glance replicatorglance replicator
glance replicator
irix_jp
 
Devinsampa nginx-scripting
Devinsampa nginx-scriptingDevinsampa nginx-scripting
Devinsampa nginx-scripting
Tony Fabeen
 

Mais procurados (20)

RestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueRestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message Queue
 
Border Patrol - Count, throttle, kick & ban in perl
Border Patrol - Count, throttle, kick & ban in perlBorder Patrol - Count, throttle, kick & ban in perl
Border Patrol - Count, throttle, kick & ban in perl
 
tdc2012
tdc2012tdc2012
tdc2012
 
Redis - Usability and Use Cases
Redis - Usability and Use CasesRedis - Usability and Use Cases
Redis - Usability and Use Cases
 
MongoDB: How it Works
MongoDB: How it WorksMongoDB: How it Works
MongoDB: How it Works
 
Redis & ZeroMQ: How to scale your application
Redis & ZeroMQ: How to scale your applicationRedis & ZeroMQ: How to scale your application
Redis & ZeroMQ: How to scale your application
 
XS Boston 2008 Debugging Xen
XS Boston 2008 Debugging XenXS Boston 2008 Debugging Xen
XS Boston 2008 Debugging Xen
 
MySQLinsanity
MySQLinsanityMySQLinsanity
MySQLinsanity
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
No more (unsecure) secrets, Marty
No more (unsecure) secrets, MartyNo more (unsecure) secrets, Marty
No more (unsecure) secrets, Marty
 
glance replicator
glance replicatorglance replicator
glance replicator
 
MongoDB Tokyo - Monitoring and Queueing
MongoDB Tokyo - Monitoring and QueueingMongoDB Tokyo - Monitoring and Queueing
MongoDB Tokyo - Monitoring and Queueing
 
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
 
MongoDB London 2013: Basic Replication in MongoDB presented by Marc Schwering...
MongoDB London 2013: Basic Replication in MongoDB presented by Marc Schwering...MongoDB London 2013: Basic Replication in MongoDB presented by Marc Schwering...
MongoDB London 2013: Basic Replication in MongoDB presented by Marc Schwering...
 
#2 (UDP)
#2 (UDP)#2 (UDP)
#2 (UDP)
 
WiredTiger In-Memory vs WiredTiger B-Tree
WiredTiger In-Memory vs WiredTiger B-TreeWiredTiger In-Memory vs WiredTiger B-Tree
WiredTiger In-Memory vs WiredTiger B-Tree
 
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오
 
Using ngx_lua in UPYUN 2
Using ngx_lua in UPYUN 2Using ngx_lua in UPYUN 2
Using ngx_lua in UPYUN 2
 
Devinsampa nginx-scripting
Devinsampa nginx-scriptingDevinsampa nginx-scripting
Devinsampa nginx-scripting
 
MySQL async message subscription platform
MySQL async message subscription platformMySQL async message subscription platform
MySQL async message subscription platform
 

Semelhante a About memcached

Memcached Presentation @757rb
Memcached Presentation @757rbMemcached Presentation @757rb
Memcached Presentation @757rb
Ken Collins
 
FrozenRails Training
FrozenRails TrainingFrozenRails Training
FrozenRails Training
Mike Dirolf
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Dvir Volk
 
Bh ad-12-stealing-from-thieves-saher-slides
Bh ad-12-stealing-from-thieves-saher-slidesBh ad-12-stealing-from-thieves-saher-slides
Bh ad-12-stealing-from-thieves-saher-slides
Matt Kocubinski
 

Semelhante a About memcached (20)

Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
Memcached Study
Memcached StudyMemcached Study
Memcached Study
 
All The Little Pieces
All The Little PiecesAll The Little Pieces
All The Little Pieces
 
Memcached Presentation @757rb
Memcached Presentation @757rbMemcached Presentation @757rb
Memcached Presentation @757rb
 
MongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & AnalyticsMongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & Analytics
 
PHP 7 – What changed internally? (Forum PHP 2015)
PHP 7 – What changed internally? (Forum PHP 2015)PHP 7 – What changed internally? (Forum PHP 2015)
PHP 7 – What changed internally? (Forum PHP 2015)
 
MiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptMiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScript
 
Caching and tuning fun for high scalability @ LOAD2012
Caching and tuning fun for high scalability @ LOAD2012Caching and tuning fun for high scalability @ LOAD2012
Caching and tuning fun for high scalability @ LOAD2012
 
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
 
PHP 7 – What changed internally? (PHP Barcelona 2015)
PHP 7 – What changed internally? (PHP Barcelona 2015)PHP 7 – What changed internally? (PHP Barcelona 2015)
PHP 7 – What changed internally? (PHP Barcelona 2015)
 
Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)
 
FrozenRails Training
FrozenRails TrainingFrozenRails Training
FrozenRails Training
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.js
 
A compact bytecode format for JavaScriptCore
A compact bytecode format for JavaScriptCoreA compact bytecode format for JavaScriptCore
A compact bytecode format for JavaScriptCore
 
Alex Smola at AI Frontiers: Scalable Deep Learning Using MXNet
Alex Smola at AI Frontiers: Scalable Deep Learning Using MXNetAlex Smola at AI Frontiers: Scalable Deep Learning Using MXNet
Alex Smola at AI Frontiers: Scalable Deep Learning Using MXNet
 
Bh ad-12-stealing-from-thieves-saher-slides
Bh ad-12-stealing-from-thieves-saher-slidesBh ad-12-stealing-from-thieves-saher-slides
Bh ad-12-stealing-from-thieves-saher-slides
 
Library Operating System for Linux #netdev01
Library Operating System for Linux #netdev01Library Operating System for Linux #netdev01
Library Operating System for Linux #netdev01
 
Passbolt Introduction and Usage for secret managment
Passbolt Introduction and Usage for secret managmentPassbolt Introduction and Usage for secret managment
Passbolt Introduction and Usage for secret managment
 

Último

Último (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

About memcached

  • 1. About Memcached E-mail lcycenter@gmail.com
  • 2. Memcached? Memcached LiveJournal , , , Web LiveJournal Memcached MogileFS Perlbal : http://www.danga.com/memcached
  • 3. ?
  • 4. ?
  • 7. Map key1: value1 key2:value2 / key3:value3 Cache Do one thing well
  • 8. Map key1: value1 key2:value2 / Expired key3:value3 Cache Do one thing well
  • 9. Map key1: value1 key2:value2 / Expired key3:value3 Cache Do one thing well I am not... persistent failover / redundant authentication RDBMS...
  • 10. Simple • C/S • support telnet interface • ✴set / get / stats
  • 11. Simple • C/S • support telnet interface • ✴set / get / stats
  • 12. Simple • C/S • support telnet interface • ✴set / get / stats
  • 13. Simple • C/S • support telnet interface • ✴set / get / stats
  • 14.
  • 15. Object getFoo(String fooId) { Object foo = memcached.get("foo" + fooId); if (foo != null) return foo; foo = database.fetchFoo(fooId); memcached.set("foo"+fooId, foo); return foo; }
  • 20. if (memcached.get(key) == null) { if (memcached.add(key_mutex, 3*60*1000) == true) { foo = database.fetchFoo(key); memcached.set(key, foo); memcached.delete(key_mutex); } else { sleep(50); retry(); } } Mutex Patten
  • 23. foo = memcached.get(key); if (foo == null) { if (memcached.add(key_mutex, 3 * 60 * 1000) == true) { foo = database.get(key); memcached.set(key, foo); memcached.delete(key_mutex); } else { sleep(50); retry(); } } else { ... } Mutex Patten II
  • 24. foo = memcached.get(key); if (foo == null) { if (memcached.add(key_mutex, 3 * 60 * 1000) == true) { foo = database.get(key); memcached.set(key, foo); memcached.delete(key_mutex); } else { sleep(50); retry(); } } else { ... here } Mutex Patten II
  • 25. if (foo.timeout >= now()) { if (memcached.add(key_mutex, 3 * 60 * 1000) == true) { foo.timeout += 3 * 60 * 1000; memcached.set(key, foo, KEY_TIMEOUT * 2); foo = database.get(key); foo.timeout = KEY_TIMEOUT; memcached.set(key, foo, KEY_TIMEOUT * 2); memcached.delete(key_mutex); } else { sleep(50); retry(); } } else { return foo; } Mutex Patten II
  • 26. if (foo.timeout >= now()) { if (memcached.add(key_mutex, 3 * 60 * 1000) == true) { foo.timeout += 3 * 60 * 1000; memcached.set(key, foo, KEY_TIMEOUT * 2); foo = database.get(key); foo.timeout = KEY_TIMEOUT; memcached.set(key, foo, KEY_TIMEOUT * 2); memcached.delete(key_mutex); } else { sleep(50); retry(); } } else { return foo; } Mutex Patten II
  • 29.
  • 30.
  • 31. ? WEB EJB RDBMS HTML Marshall SQL JSON Java Results XML Objects
  • 32. ? WEB EJB RDBMS HTML Marshall SQL JSON Java Results XML Objects
  • 33. ? WEB EJB RDBMS HTML Marshall SQL JSON Java Results XML Objects
  • 34. (memcached exptimes) • - SET or DELETE - • version - version key: user_v2_100 - + LRU
  • 35. Distribute Memcached • MC HASH • MC Fail-over • MC-MC • DB-MC fail • Key-Value DB
  • 36. MC Hash • - MC • Hash - - - •
  • 37. idx = Zlib.crc32(key) % servers.size Consistent Hashing
  • 40. Others • • hot keys • create local cache • alias key •
  • 41.
  • 42.
  • 43.
  • 44. Memcached Client • Marshall • • Multiget support • Compressed support • Async/Sync Modes • Replicated • ...
  • 45. Stats • Memcached: • telnet • : stats
  • 46. Stats
  • 47. Limits • Key Size (250 bytes) • Data Size (under 1 megabyte) • 32bit/64bit (maximum size of the process)
  • 48. Protocol Commands • set / get / gets / replace / add / delete • append / prepend • increment / decrement • cas (compare and swap atomic!) • stats(detail)
  • 49. Numbers Everyone Should Know L1 cache reference 0.5 ns Branch mispredict 5 ns L2 cache reference 7 ns Mutex lock/unlock 100 ns Main memory reference * 100 ns Compress 1K bytes with Zippy 10,000 ns Send 2K bytes over 1 Gbps network * 20,000 ns Read 1 MB sequentially from memory * 250,000 ns Round trip within same datacenter 500,000 ns Disk seek * 10,000,000 ns Read 1 MB sequentially from network * 10,000,000 ns Read 1 MB sequentially from disk * 30,000,000 ns Send packet CA->Netherlands->CA 150,000,000 ns

Notas do Editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. 1. NullObject\n2. Expire时的Cache击穿问题\n
  16. 应用服务器侧:\n1. 取不到数据?\n2. 超时怎么控制?\n\n引入了prefetch worker:\n1. 多了一个run component\n2. 增加了开发、测试、维护的复杂性\n3. 好的系统:自成系统\n
  17. \n
  18. \n
  19. \n
  20. 在value内部设置1个超时值(timeout1), timeout1比实际的memcache timeout(timeout2)小。当从cache读取到timeout1发现它已经过期时候,马上延长timeout1并重新设置\n
  21. 在value内部设置1个超时值(timeout1), timeout1比实际的memcache timeout(timeout2)小。当从cache读取到timeout1发现它已经过期时候,马上延长timeout1并重新设置\n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. 常用:\n1.指定失效时间 + 程序触发\n2.指定失效时间也适用于防止系统错误导致脏数据\n
  31. 单纯把MC当MEM用时需要做Failover\n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n