First import

This commit is contained in:
Andrei Zmievski
2008-12-14 10:08:59 -08:00
commit 79db1e4439
20 changed files with 1004 additions and 0 deletions

44
.cvsignore Normal file
View File

@@ -0,0 +1,44 @@
*.lo
*.la
.deps
.libs
Makefile
Makefile.fragments
Makefile.global
Makefile.objects
acinclude.m4
aclocal.m4
autom4te.cache
build
config.cache
config.guess
config.h
config.h.in
config.log
config.nice
config.status
config.sub
configure
configure.in
conftest
conftest.c
include
install-sh
libtool
ltmain.sh
missing
mkinstalldirs
modules
scan_makefile_in.awk
*.dsw
*.plg
*.opt
*.ncb
Release
Release_inline
Debug
Release_TS
Release_TSDbg
Release_TS_inline
Debug_TS
memcached*.tgz

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.swp

2
CREDITS Normal file
View File

@@ -0,0 +1,2 @@
memcached
Andrei Zmievski

5
EXPERIMENTAL Normal file
View File

@@ -0,0 +1,5 @@
this extension is experimental,
its functions may change their names
or move to extension all together
so do not rely to much on them
you have been warned!

68
LICENSE Normal file
View File

@@ -0,0 +1,68 @@
--------------------------------------------------------------------
The PHP License, Version 3.0
Copyright (c) 1999 - 2003 The PHP Group. All rights reserved.
--------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, is permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The name "PHP" must not be used to endorse or promote products
derived from this software without prior written permission. For
written permission, please contact group@php.net.
4. Products derived from this software may not be called "PHP", nor
may "PHP" appear in their name, without prior written permission
from group@php.net. You may indicate that your software works in
conjunction with PHP by saying "Foo for PHP" instead of calling
it "PHP Foo" or "phpfoo"
5. The PHP Group may publish revised and/or new versions of the
license from time to time. Each version will be given a
distinguishing version number.
Once covered code has been published under a particular version
of the license, you may always continue to use it under the terms
of that version. You may also choose to use such covered code
under the terms of any subsequent version of the license
published by the PHP Group. No one other than the PHP Group has
the right to modify the terms applicable to covered code created
under this License.
6. Redistributions of any form whatsoever must retain the following
acknowledgment:
"This product includes PHP, freely available from
<http://www.php.net/>".
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------
This software consists of voluntary contributions made by many
individuals on behalf of the PHP Group.
The PHP Group can be contacted via Email at group@php.net.
For more information on the PHP Group and the PHP project,
please see <http://www.php.net>.
This product includes the Zend Engine, freely available at
<http://www.zend.com>.

70
README Normal file
View File

@@ -0,0 +1,70 @@
This is a standalone PHP extension created using CodeGen_PECL 1.1.2
HACKING
=======
There are two ways to modify an extension created using CodeGen_PECL:
1) you can modify the generated code as with any other PHP extension
2) you can add custom code to the CodeGen_PECL XML source and re-run pecl-gen
The 2nd approach may look a bit complicated but you have be aware that any
manual changes to the generated code will be lost if you ever change the
XML specs and re-run PECL-Gen. All changes done before have to be applied
to the newly generated code again.
Adding code snippets to the XML source itself on the other hand may be a
bit more complicated but this way your custom code will always be in the
generated code no matter how often you rerun CodeGen_PECL.
BUILDING ON UNIX etc.
=====================
To compile your new extension, you will have to execute the following steps:
1. $ ./phpize
2. $ ./configure [--with-memcached=...]
3. $ make
4. $ make test
5. $ [sudo] make install
BUILDING ON WINDOWS
===================
The extension provides the VisualStudio V6 project file
memcached.dsp
To compile the extension you open this file using VisualStudio,
select the apropriate configuration for your installation
(either "Release_TS" or "Debug_TS") and create "php_memcached.dll"
After successfull compilation you have to copy the newly
created "memcached.dll" to the PHP
extension directory (default: C:\PHP\extensions).
TESTING
=======
You can now load the extension using a php.ini directive
extension="memcached.[so|dll]"
or load it at runtime using the dl() function
dl("memcached.[so|dll]");
The extension should now be available, you can test this
using the extension_loaded() function:
if (extension_loaded("memcached"))
echo "memcached loaded :)";
else
echo "something is wrong :(";
The extension will also add its own block to the output
of phpinfo();

58
config.m4 Normal file
View File

@@ -0,0 +1,58 @@
dnl
dnl $ Id: $
dnl
PHP_ARG_WITH(memcached, libmemcached,[ --with-memcached[=DIR] With memcached support])
if test "$PHP_MEMCACHED" != "no"; then
if test -r "$PHP_MEMCACHED/include/libmemcached/memcached.h"; then
PHP_MEMCACHED_DIR="$PHP_MEMCACHED"
else
AC_MSG_CHECKING(for memcached in default path)
for i in /usr /usr/local; do
if test -r "$i/include/libmemcached/memcached.h"; then
PHP_MEMCACHED_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
done
if test "x" = "x$PHP_MEMCACHED_DIR"; then
AC_MSG_ERROR(not found)
fi
fi
export OLD_CPPFLAGS="$CPPFLAGS"
export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_MEMCACHED"
export CPPFLAGS="$OLD_CPPFLAGS"
PHP_ADD_INCLUDE($PHP_MEMCACHED_DIR/include)
export OLD_CPPFLAGS="$CPPFLAGS"
export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_MEMCACHED"
AC_MSG_CHECKING(PHP version)
AC_TRY_COMPILE([#include <php_version.h>], [
#if PHP_VERSION_ID < 40000
#error this extension requires at least PHP version 4.0.0
#endif
],
[AC_MSG_RESULT(ok)],
[AC_MSG_ERROR([need at least PHP 4.0.0])])
AC_CHECK_HEADER([libmemcached/memcached.h], [], AC_MSG_ERROR('libmemcached/memcached.h' header not found))
export CPPFLAGS="$OLD_CPPFLAGS"
PHP_SUBST(MEMCACHED_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(memcached, $PHP_MEMCACHED_DIR/lib, MEMCACHED_SHARED_LIBADD)
PHP_SUBST(MEMCACHED_SHARED_LIBADD)
AC_DEFINE(HAVE_MEMCACHED, 1, [ ])
PHP_NEW_EXTENSION(memcached, memcached.c , $ext_shared)
fi

17
config.w32 Normal file
View File

@@ -0,0 +1,17 @@
// $ Id: $
// vim:ft=javascript
ARG_WITH('memcached', 'libmemcached extension', 'no');
if (PHP_MEMCACHED == "yes") {
if (!CHECK_LIB("memcached.lib", "memcached", PHP_MEMCACHED)) {
ERROR("memcached: library 'memcached' not found");
}
if (!CHECK_HEADER_ADD_INCLUDE("libmemcached/memcached.h", "CFLAGS_MEMCACHED")) {
ERROR("memcached: header 'libmemcached/memcached.h' not found");
}
EXTENSION("memcached", "memcached.c");
AC_DEFINE("HAVE_MEMCACHED", 1, "memcached support");
}

24
manual/Makefile Normal file
View File

@@ -0,0 +1,24 @@
#
all: html
confcheck:
@if test "x$(PHPDOC)" = "x"; then echo PHPDOC not set; exit 3; fi
manual.xml: manual.xml.in
sed -e's:@PHPDOC@:$(PHPDOC):g' < manual.xml.in > manual.xml
html: confcheck manual.xml
rm -rf html; mkdir html
SP_ENCODING=XML SP_CHARSET_FIXED=YES openjade -D $(PHPDOC) -wno-idref -c $(PHPDOC)/docbook/docbook-dsssl/catalog -c $(PHPDOC)/phpbook/phpbook-dsssl/defaults/catalog -d $(PHPDOC)/phpbook/phpbook-dsssl/html.dsl -V use-output-dir -t sgml $(PHPDOC)/phpbook/phpbook-xml/phpdocxml.dcl manual.xml
bightml: confcheck manual.xml
rm -rf html; mkdir html
SP_ENCODING=XML SP_CHARSET_FIXED=YES openjade -D $(PHPDOC) -wno-idref -c $(PHPDOC)/docbook/docbook-dsssl/catalog -c $(PHPDOC)/phpbook/phpbook-dsssl/defaults/catalog -d $(PHPDOC)/phpbook/phpbook-dsssl/html.dsl -V nochunks -t sgml $(PHPDOC)/phpbook/phpbook-xml/phpdocxml.dcl manual.xml > manual.html
tex: manual.tex
manual.tex: confcheck manual.xml
SP_ENCODING=XML SP_CHARSET_FIXED=YES openjade -D $(PHPDOC) -wno-idref -c $(PHPDOC)/docbook/docbook-dsssl/catalog -c $(PHPDOC)/phpbook/phpbook-dsssl/defaults/catalog -d $(PHPDOC)/phpbook/phpbook-dsssl/print.dsl -t tex $(PHPDOC)/phpbook/phpbook-xml/phpdocxml.dcl manual.xml
pdf: manual.tex
pdfjadetex manual.tex && pdfjadetex manual.tex && pdfjadetex manual.tex

3
manual/file-entities.ent Normal file
View File

@@ -0,0 +1,3 @@
<!ENTITY reference.memcached.reference SYSTEM './memcached/reference.xml'>
<!ENTITY reference.memcached.configure SYSTEM './memcached/configure.xml'>
<!ENTITY reference.memcached.functions SYSTEM './functions.xml'>

0
manual/functions.xml Normal file
View File

37
manual/manual.xml.in Normal file
View File

@@ -0,0 +1,37 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE book PUBLIC '-//OASIS//DTD DocBook XML V4.1.2//EN'
'@PHPDOC@/dtds/dbxml-4.1.2/docbookx.dtd' [
<!-- Add translated specific definitions and snippets -->
<!ENTITY % language-defs SYSTEM '@PHPDOC@/en/language-defs.ent'>
<!ENTITY % language-snippets SYSTEM '@PHPDOC@/en/language-snippets.ent'>
%language-defs;
%language-snippets;
<!-- Fallback to English definitions and snippets (in case of missing translation) -->
<!ENTITY % language-defs.default SYSTEM '@PHPDOC@/en/language-defs.ent'>
<!ENTITY % language-snippets.default SYSTEM '@PHPDOC@/en/language-snippets.ent'>
<!ENTITY % extensions.default SYSTEM '@PHPDOC@/en/extensions.ent'>
%language-defs.default;
%language-snippets.default;
%extensions.default;
<!-- All global entities for the XML files -->
<!ENTITY % global.entities SYSTEM '@PHPDOC@/entities/global.ent'>
<!ENTITY % file.entities SYSTEM './file-entities.ent'>
<!-- Include all external DTD parts defined previously -->
%global.entities;
%file.entities;
<!-- Autogenerated missing entites and IDs to make build work -->
<!ENTITY % missing-entities SYSTEM '@PHPDOC@/entities/missing-entities.ent'>
%missing-entities;
]>
<book id='manual' lang='en'>
&reference.memcached.reference;
</book>

View File

@@ -0,0 +1,43 @@
<section id='memcached.requirements'>
&reftitle.required;
<para>This extension requires the following library: memcached</para>
<para>This extension requires the following header: libmemcached/memcached.h</para>
</section>
<section id='memcached.install'>
&reftitle.install;
<para>Requires <literal>memcached</literal></para>
</section>
<section id='memcached.configuration'>
&reftitle.runtime;
&no.config;
</section>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -0,0 +1,53 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.1 $ -->
<reference id='ref.memcached'>
<title>libmemcached extension</title>
<titleabbrev>memcached</titleabbrev>
<partintro>
<section id='memcached.intro'>
&reftitle.intro;
<para>
Extension for interfacing with memcache servers via libmemcached library.
</para>
</section>
&reference.memcached.configure;
<section id='memcached.resources'>
&reftitle.resources;
&no.resource;
</section>
<section id='memcached.constants'>
&reftitle.constants;
&no.constants;
</section>
</partintro>
&reference.memcached.functions;
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

140
memcached-api.php Normal file
View File

@@ -0,0 +1,140 @@
<?php
/**
* Collator class.
*/
class Memcached {
/**
* Libmemcached behavior options.
*/
const OPT_HASH;
const OPT_HASH_DEFAULT;
const OPT_HASH_MD5;
const OPT_HASH_CRC;
const OPT_HASH_FNV1_64;
const OPT_HASH_FNV1A_64;
const OPT_HASH_FNV1_32;
const OPT_HASH_FNV1A_32;
const OPT_HASH_HSIEH;
const OPT_HASH_MURMUR;
const OPT_DISTRIBUTION;
const OPT_DISTRIBUTION_MODULA;
const OPT_DISTRIBUTION_CONSISTENT;
const OPT_BUFER_REQUESTS;
const OPT_BINARY_PROTOCOL;
const OPT_NO_BLOCK;
const OPT_TCP_NODELAY;
const OPT_SOCKET_SEND_SIZE;
const OPT_SOCKET_RECV_SIZE;
const OPT_CONNECT_TIMEOUT;
const OPT_CONNECT_TIMEOUT;
const OPT_RETRY_TIMEOUT;
const OPT_SND_TIMEOUT;
const OPT_RCV_TIMEOUT;
const OPT_POLL_TIMEOUT;
/**
* Class options.
*/
const OPT_COMPRESSION;
const OPT_PREFIX_KEY;
public function __construct( $locale ) {}
public function get( $key, $cache_cb = null ) {}
public function getByKey( $server_key, $key, $cache_cb = null ) {}
public function getDelayed( $array $cache_cb = null, $value_cb = null ) {}
public function getDelayedByKey( $server_key, $key $cache_cb = null, $value_cb = null ) {}
public function fetch( ) {}
public function fetchAll( ) {}
public function set( $key, $value, $expiration ) {}
public function setByKey( $server_key, $key, $value, $expiration ) {}
public function setMulti( $array, $expiration ) {}
public function setMultiByKey( $server_key, $array, $expiration ) {}
public function getLastTokens( ) {}
public function cas( $token, $key, $value, $expiration ) {}
public function casByKey( $token, $server_key, $key, $value, $expiration ) {}
public function add( $key, $value, $expiration ) {}
public function addByKey( $server_ke, $key, $value, $expiration ) {}
public function append( $key, $value, $expiration ) {}
public function appendByKey( $server_ke, $key, $value, $expiration ) {}
public function prepend( $key, $value, $expiration ) {}
public function prependByKey( $server_key, $key, $value, $expiration ) {}
public function replace( $key, $value, $expiration ) {}
public function replaceByKey( $serve_key, $key, $value, $expiration ) {}
public function delete( $key, $expiration ) {}
public function deleteByKey( $key, $expiration ) {}
public function increment( $key, $offset ) {}
public function decrement( $key, $offset ) {}
public function getOption( $option ) {}
public function setOption( $option, $value ) {}
public function addServer( $host, $port, $weight = 0 );
public function getServerList ( ) {}
public function getServerByKey ( $server_key ) {}
}
class MemcachedException extends Exception {
function __construct( $errmsg = "", $errcode = 0) {}
}

113
memcached.c Normal file
View File

@@ -0,0 +1,113 @@
/*
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Andrei Zmievski <andrei@php.net> |
+----------------------------------------------------------------------+
*/
/* $ Id: $ */
#include "php_memcached.h"
#if HAVE_MEMCACHED
/* {{{ memcached_functions[] */
function_entry memcached_functions[] = {
{ NULL, NULL, NULL }
};
/* }}} */
/* {{{ memcached_module_entry
*/
zend_module_entry memcached_module_entry = {
STANDARD_MODULE_HEADER,
"memcached",
memcached_functions,
PHP_MINIT(memcached), /* Replace with NULL if there is nothing to do at php startup */
PHP_MSHUTDOWN(memcached), /* Replace with NULL if there is nothing to do at php shutdown */
PHP_RINIT(memcached), /* Replace with NULL if there is nothing to do at request start */
PHP_RSHUTDOWN(memcached), /* Replace with NULL if there is nothing to do at request end */
PHP_MINFO(memcached),
"0.1.0",
STANDARD_MODULE_PROPERTIES
};
/* }}} */
#ifdef COMPILE_DL_MEMCACHED
ZEND_GET_MODULE(memcached)
#endif
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(memcached)
{
/* add your stuff here */
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MSHUTDOWN_FUNCTION */
PHP_MSHUTDOWN_FUNCTION(memcached)
{
/* add your stuff here */
return SUCCESS;
}
/* }}} */
/* {{{ PHP_RINIT_FUNCTION */
PHP_RINIT_FUNCTION(memcached)
{
/* add your stuff here */
return SUCCESS;
}
/* }}} */
/* {{{ PHP_RSHUTDOWN_FUNCTION */
PHP_RSHUTDOWN_FUNCTION(memcached)
{
/* add your stuff here */
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION */
PHP_MINFO_FUNCTION(memcached)
{
php_info_print_box_start(0);
php_printf("<p>libmemcached extension</p>\n");
php_printf("<p>Version 0.1.0</p>\n");
php_printf("<p><b>Authors:</b></p>\n");
php_printf("<p>Andrei Zmievski &lt;andrei@php.net&gt; (lead)</p>\n");
php_info_print_box_end();
}
/* }}} */
#endif /* HAVE_MEMCACHED */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim: noet sw=4 ts=4 fdm=marker:
*/

112
memcached.dsp Normal file
View File

@@ -0,0 +1,112 @@
# Microsoft Developer Studio Project File - Name="memcached" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=memcached - Win32 Debug_TS
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "memcached.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "memcached.mak" CFG="memcached - Win32 Debug_TS"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "memcached - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "memcached - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "memcached - Win32 Release_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release_TS"
# PROP BASE Intermediate_Dir "Release_TS"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release_TS"
# PROP Intermediate_Dir "Release_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MEMCACHED_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_MEMCACHED" /D ZTS=1 /D HAVE_MEMCACHED=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG"
# ADD RSC /l 0x407 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib memcached.lib /nologo /dll /machine:I386
# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib memcached.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_memcached.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
!ELSEIF "$(CFG)" == "memcached - Win32 Debug_TS"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug_TS"
# PROP BASE Intermediate_Dir "Debug_TS"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug_TS"
# PROP Intermediate_Dir "Debug_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MEMCACHED_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_MEMCACHED" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MEMCACHED=1 /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "_DEBUG"
# ADD RSC /l 0x407 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib memcached.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib memcached.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_memcached.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
!ENDIF
# Begin Target
# Name "memcached - Win32 Release_TS"
# Name "memcached - Win32 Debug_TS"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=./memcached.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\php_memcached.h
# End Source File
# End Group
# End Target
# End Project

50
package.xml Normal file
View File

@@ -0,0 +1,50 @@
<?xml version="1.0"?>
<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0">
<package>
<name>memcached</name>
<summary>libmemcached extension</summary>
<description>
Extension for interfacing with memcache servers via libmemcached library.
</description>
<license>PHP</license>
<configureoptions>
<configureoption name="with-memcached" default="autodetect" prompt="memcached installation directory?" />
</configureoptions>
<maintainers>
<maintainer>
<user>andrei</user>
<name>Andrei Zmievski</name>
<email>andrei@php.net</email>
<role>lead</role>
</maintainer>
</maintainers>
<release>
<version>0.0.1</version>
<state>devel</state>
<notes>unknown</notes>
<date>2008-12-14</date>
</release>
<changelog>
</changelog>
<deps>
<dep type="php" rel="ge" version="4.0.0"/>
</deps>
<filelist>
<dir name="/">
<file role='doc' name='EXPERIMENTAL'/>
<file role='doc' name='CREDITS'/>
<file role='src' name='config.m4'/>
<file role='src' name='memcached.dsp'/>
<file role='src' name='config.w32'/>
<file role='src' name='memcached.c'/>
<file role='src' name='php_memcached.h'/>
</dir>
</filelist>
</package>

71
package2.xml Normal file
View File

@@ -0,0 +1,71 @@
<?xml version="1.0"?>
<package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0"
xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
http://pear.php.net/dtd/tasks-1.0.xsd
http://pear.php.net/dtd/package-2.0
http://pear.php.net/dtd/package-2.0.xsd">
<name>memcached</name>
<channel>pecl.php.net</channel>
<summary>libmemcached extension</summary>
<description>
Extension for interfacing with memcache servers via libmemcached library.
</description>
<lead>
<name>Andrei Zmievski</name>
<user>andrei</user>
<email>andrei@php.net</email>
<active>yes</active>
</lead>
<date>2008-12-14</date>
<version>
<release>0.0.1</release>
<api>0.0.1</api>
</version>
<stability>
<release>devel</release>
<api>devel</api>
</stability>
<license uri="http://php.net/license" filesource="LICENSE">PHP</license>
<notes>
none
</notes>
<contents>
<dir name="/">
<file role='doc' name='EXPERIMENTAL'/>
<file role='doc' name='CREDITS'/>
<file role='src' name='config.m4'/>
<file role='src' name='memcached.dsp'/>
<file role='src' name='config.w32'/>
<file role='src' name='memcached.c'/>
<file role='src' name='php_memcached.h'/>
</dir>
</contents>
<dependencies>
<required>
<php>
<min>4.0.0</min>
</php>
<pearinstaller>
<min>1.4.0a1</min>
</pearinstaller>
</required>
</dependencies>
<providesextension>memcached</providesextension>
<extsrcrelease>
<configureoption name="with-memcached" default="autodetect" prompt="memcached installation directory?" />
</extsrcrelease>
</package>

93
php_memcached.h Normal file
View File

@@ -0,0 +1,93 @@
/*
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Andrei Zmievski <andrei@php.net> |
+----------------------------------------------------------------------+
*/
/* $ Id: $ */
#ifndef PHP_MEMCACHED_H
#define PHP_MEMCACHED_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <php.h>
#ifdef HAVE_MEMCACHED
#include <php_ini.h>
#include <SAPI.h>
#include <ext/standard/info.h>
#include <Zend/zend_extensions.h>
#ifdef __cplusplus
} // extern "C"
#endif
#include <libmemcached/memcached.h>
#ifdef __cplusplus
extern "C" {
#endif
extern zend_module_entry memcached_module_entry;
#define phpext_memcached_ptr &memcached_module_entry
#ifdef PHP_WIN32
#define PHP_MEMCACHED_API __declspec(dllexport)
#else
#define PHP_MEMCACHED_API
#endif
PHP_MINIT_FUNCTION(memcached);
PHP_MSHUTDOWN_FUNCTION(memcached);
PHP_RINIT_FUNCTION(memcached);
PHP_RSHUTDOWN_FUNCTION(memcached);
PHP_MINFO_FUNCTION(memcached);
#ifdef ZTS
#include "TSRM.h"
#endif
#define FREE_RESOURCE(resource) zend_list_delete(Z_LVAL_P(resource))
#define PROP_GET_LONG(name) Z_LVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
#define PROP_SET_LONG(name, l) zend_update_property_long(_this_ce, _this_zval, #name, strlen(#name), l TSRMLS_CC)
#define PROP_GET_DOUBLE(name) Z_DVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
#define PROP_SET_DOUBLE(name, d) zend_update_property_double(_this_ce, _this_zval, #name, strlen(#name), d TSRMLS_CC)
#define PROP_GET_STRING(name) Z_STRVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
#define PROP_GET_STRLEN(name) Z_STRLEN_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
#define PROP_SET_STRING(name, s) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s TSRMLS_CC)
#define PROP_SET_STRINGL(name, s, l) zend_update_property_stringl(_this_ce, _this_zval, #name, strlen(#name), s, l TSRMLS_CC)
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* PHP_HAVE_MEMCACHED */
#endif /* PHP_MEMCACHED_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/