C API?

Brad Fitzpatrick brad@danga.com
Sun, 30 May 2004 19:33:43 -0700 (PDT)


Steve,

Yeah.  :/

The closest thing you'll find is the PECL PHP client, which is mostly
written in C, albeit using some PHP innards:

http://pecl.php.net/package/memcache/

The issues with a C client:

-- who allocates memory?  the library (with or without a caller-defined
   allocator), or the caller?  and since the caller doesn't know the
   item length ahead of time, a caller-allocates scheme doesn't seem
   to work, but some people want that.

-- complex structures.  (just don't support them)

-- by hand, or with NPR/APR/glib/gnet?  but that might depend on what
   license the resultant C library is desired under.

Other than that, porting the Perl client to C should be fairly
straight-forward, especially using some portability library.


On Sun, 30 May 2004, Steve Simitzis wrote:

> hi list.
>
> looking through the archives, i found there has been some occasional
> discussion of a C API. some claim to be working on one, others claim
> that one doesn't exist.
>
> does anyone have a C API with the basics completed? if so, i would
> love to use it. (i fear the prospect of writing it myself.)
>
> my application - i have a web app written in PHP and a static content
> server written in C. both need to share the same mysql database,
> so it would be nice if they could both share a memcached cache.
>
> i'm guessing it will be slightly problematic if different APIs store
> data structures in a form that's native to the specific language using
> the API, but probably not impossible to work with.
>
> thanks!
>
> --
>
> steve simitzis : /sim' - i - jees/
>           pala : saturn5 productions
>  www.steve.org : 415.282.9979
>   hath the daemon spawn no fire?
>
>