Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6016929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:03:17+00:00 2026-05-23T03:03:17+00:00

i run a python script whitch cache some data self.cache.set(‘test’, ‘my sample data’, 300)

  • 0

i run a python script whitch cache some data

self.cache.set('test', 'my sample data', 300)
data = self.cache.get('test')
self.p(data)

this program will result in print of ‘my sample data’ … everything its good, but when i try to access this key from php

$data = $this->cache->get('test');
print_r($test);

i only get empty result
so i check the server stats

$list = array();
$allSlabs = $this->cache->getExtendedStats('slabs');
$items = $this->cache->getExtendedStats('items');
foreach($allSlabs as $server => $slabs) {
    foreach($slabs AS $slabId => $slabMeta) {
        $cdump = $this->cache->getExtendedStats('cachedump',(int)$slabId);
            foreach($cdump AS $server => $entries) {
                if($entries) {
                foreach($entries AS $eName => $eData) {
                    $list[$eName] = array(
                        'key' => $eName,
                        'server' => $server,
                        'slabId' => $slabId,
                        'detail' => $eData,
                        'age' => $items[$server]['items'][$slabId]['age'],
                    );
                }
                }
            }
        }
    }
ksort($list);
print_r($list);

and this key ‘test’ is there … but i cannot access it

if i cache something in php i get the result everytime, but somehow this python + php cache wont work

if someone has an idea where could be a problem plese advice … i try everything

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:03:18+00:00Added an answer on May 23, 2026 at 3:03 am

    Could it be that the hashes don’t match between PHP and Python? A solution is here: http://www.ruturaj.net/python-php-memcache-hash

    Add the following to your Python script to change how hashes are calculated…

    import memcache
    import binascii
    m = memcache.Client(['192.168.28.7:11211', '192.168.28.8:11211
    ', '192.168.28.9:11211'])
    
    def php_hash(key):
        return (binascii.crc32(key) >> 16) & 0x7fff
    
    for i in range(30):
           key = 'key' + str(i)
           a = m.get((php_hash(key), key))
           print i, a
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to run some python code under Apache 2.2 / mod_python 3.2.8. Eventually
I have some Python code that works correctly when I use python.exe to run
I am trying to run a python script which has the following statements: import
I have a python script which I would like to run at regular intervals.
I have a python script which uses subprocess.Popen to run multiple instances of another
I want to run a Python script from another Python script. I want to
i want to run and control PSFTP from a Python script in order to
I'm trying to run Python scripts using Xcode's User Scripts menu. The issue I'm
I want to run javascript/Python/Ruby inside my application. I have an application that creates
Can I run the python interpreter without generating the compiled .pyc files?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.