Giter Club home page Giter Club logo

phpmemcachesasl's Introduction

MemcacheSASL

A PHP Memcache client with binary protocol and SASL support.

You can find documentation on the PHP Memcached class here.

phpmemcachesasl's People

Contributors

asafdav avatar ronnywang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phpmemcachesasl's Issues

Increment and Decrement Implementation Not Working Correctly

Increment and decrement don't appear to be functioning correctly. I did the following

$m->set('testkey',0);
var_dump($m->get('testkey'));
var_dump($m->increment('testkey'));
var_dump($m->get('testkey'));

which output

int(0)
bool(true)
int(2147483647)

2147483647 is 0x7FFFFFFF

I was expecting the value returned to be 1.

GetStats impelementations

public function getStats($type=null){
    $this->_send(array(
            'opcode' => 0x10,
            'key'=>$type
            ));
    $ret = array();
    $item = $this->_recv();
    while ( !empty($item['key'])  ){
        $ret[$item['key']] = $item['body'];
        $item = $this->_recv();
    }
    return $ret;
}

Add license

Without any license, nobody can properly use this class in their own projects. Please add at least a license header or even better a LICENSE file.

Problem with setSaveHandler function

Hello,

I have a problem when I try to use setSaveHandler() to use Memcache as sessions handler

Here is the code

require 'MemcacheSASL.php';
$m = new MemcacheSASL;
$m->addServer('host', 11211);
$m->setSaslAuthData('user', 'password');
$m->setSaveHandler();

session_start();
$_SESSION['test'] = 'test1';
echo $_SESSION['test'];

It's doesn't print 'test1' as expected and there is an error in the log file

Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.8 with Suhosin-Patch configured
PHP Fatal error: Using $this when not in object context in MemcacheSASL.php on line 450

Could you please help check and fix this?

Keys and Values are improperly constrained to type String

The following function implicitly constrains the data type of cache keys and values to String. Memcache and the binary SASL protocol support both keys and values of arbitrary type since they are binary formats. The client library should not assume that these items are strings.

protected function _build_request($data)
{
$valuelength = $extralength = $keylength = 0;
if (array_key_exists('extra', $data)) {
$extralength = strlen($data['extra']);
}
if (array_key_exists('key', $data)) {
$keylength = strlen($data['key']);
}
if (array_key_exists('value', $data)) {
$valuelength = strlen($data['value']);
}
...
...
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.