dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7ffc3c2
)
move global constants to class-specific constants, to avoid collisions with Memcache...
author
Domas Mituzas
<midom@users.mediawiki.org>
Tue, 18 Mar 2008 09:54:43 +0000
(09:54 +0000)
committer
Domas Mituzas
<midom@users.mediawiki.org>
Tue, 18 Mar 2008 09:54:43 +0000
(09:54 +0000)
includes/memcached-client.php
patch
|
blob
|
history
diff --git
a/includes/memcached-client.php
b/includes/memcached-client.php
index
2eddb90
..
21f0c83
100644
(file)
--- a/
includes/memcached-client.php
+++ b/
includes/memcached-client.php
@@
-64,28
+64,6
@@
// {{{ requirements
// }}}
// {{{ requirements
// }}}
-// {{{ constants
-// {{{ flags
-
-/**
- * Flag: indicates data is serialized
- */
-define("MEMCACHE_SERIALIZED", 1<<0);
-
-/**
- * Flag: indicates data is compressed
- */
-define("MEMCACHE_COMPRESSED", 1<<1);
-
-// }}}
-
-/**
- * Minimum savings to store data compressed
- */
-define("COMPRESSION_SAVINGS", 0.20);
-
-// }}}
-
// {{{ class memcached
/**
* memcached client class implemented using (p)fsockopen()
// {{{ class memcached
/**
* memcached client class implemented using (p)fsockopen()
@@
-98,6
+76,29
@@
class memcached
// {{{ properties
// {{{ public
// {{{ properties
// {{{ public
+ // {{{ constants
+ // {{{ flags
+
+ /**
+ * Flag: indicates data is serialized
+ */
+ const SERIALIZED = 1;
+
+ /**
+ * Flag: indicates data is compressed
+ */
+ const COMPRESSED = 2;
+
+ // }}}
+
+ /**
+ * Minimum savings to store data compressed
+ */
+ const COMPRESSION_SAVINGS = 0.20;
+
+ // }}}
+
+
/**
* Command statistics
*
/**
* Command statistics
*
@@
-904,12
+905,12
@@
class memcached
return false;
}
return false;
}
- if ($this->_have_zlib && $flags &
MEMCACHE_
COMPRESSED)
+ if ($this->_have_zlib && $flags &
memcached::
COMPRESSED)
$ret[$rkey] = gzuncompress($ret[$rkey]);
$ret[$rkey] = rtrim($ret[$rkey]);
$ret[$rkey] = gzuncompress($ret[$rkey]);
$ret[$rkey] = rtrim($ret[$rkey]);
- if ($flags &
MEMCACHE_
SERIALIZED)
+ if ($flags &
memcached::
SERIALIZED)
$ret[$rkey] = unserialize($ret[$rkey]);
} else
$ret[$rkey] = unserialize($ret[$rkey]);
} else
@@
-950,7
+951,7
@@
class memcached
if (!is_scalar($val))
{
$val = serialize($val);
if (!is_scalar($val))
{
$val = serialize($val);
- $flags |=
MEMCACHE_
SERIALIZED;
+ $flags |=
memcached::
SERIALIZED;
if ($this->_debug)
$this->_debugprint(sprintf("client: serializing data as it is not scalar\n"));
}
if ($this->_debug)
$this->_debugprint(sprintf("client: serializing data as it is not scalar\n"));
}
@@
-963,13
+964,13
@@
class memcached
$c_val = gzcompress($val, 9);
$c_len = strlen($c_val);
$c_val = gzcompress($val, 9);
$c_len = strlen($c_val);
- if ($c_len < $len*(1 - COMPRESSION_SAVINGS))
+ if ($c_len < $len*(1 -
memcached::
COMPRESSION_SAVINGS))
{
if ($this->_debug)
$this->_debugprint(sprintf("client: compressing data; was %d bytes is now %d bytes\n", $len, $c_len));
$val = $c_val;
$len = $c_len;
{
if ($this->_debug)
$this->_debugprint(sprintf("client: compressing data; was %d bytes is now %d bytes\n", $len, $c_len));
$val = $c_val;
$len = $c_len;
- $flags |=
MEMCACHE_
COMPRESSED;
+ $flags |=
memcached::
COMPRESSED;
}
}
if (!$this->_safe_fwrite($sock, "$cmd $key $flags $exp $len\r\n$val\r\n"))
}
}
if (!$this->_safe_fwrite($sock, "$cmd $key $flags $exp $len\r\n$val\r\n"))
@@
-979,7
+980,7
@@
class memcached
if ($this->_debug)
{
if ($this->_debug)
{
- if ($flags &
MEMCACHE_
COMPRESSED)
+ if ($flags &
memcached::
COMPRESSED)
$val = 'compressed data';
$this->_debugprint(sprintf("MemCache: %s %s => %s (%s)\n", $cmd, $key, $val, $line));
}
$val = 'compressed data';
$this->_debugprint(sprintf("MemCache: %s %s => %s (%s)\n", $cmd, $key, $val, $line));
}