PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, November 13, 2022

[FIXED] How do I check if a key exists in Memcache (AWS Elastic Cache instance) using python?

 November 13, 2022     amazon-web-services, caching, memcached, python     No comments   

Issue

I'm trying to create a dynamic query which will be a part of memcache key. Is there any way to lookup keys in the memcache? I'm trying to acheive this because if there is any way, I would first lookup in that keymap and will create a new key only if it doesn't exist.

I'm using python + Pymemcache module.


Solution

Nevertheless, I found one simple way to check that. So, posting it as an answer.

if client.get(key) is None:
    //your_code


Answered By - Pavan
Answer Checked By - Timothy Miller (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing