I've written an Object Cache in PHP.
http://code.google.com/p/php-object-cache/

However, it requires PHP Sockets support which is not available on a lot of PHP builds.

Coming to the conclusion that all hosting that support PHP should support C, I'm going to rewrite this in C.

The PHP source is here:
http://code.google.com/p/php-object-cache/source/browse/trunk/socket.class.php

Basically it is a socket deamon, that just persists any Object sent to it, in memory. The objects are serialized as JSON strings, but stored as PHP Objects in the deamon.

So my question is, in C, do I save these objects as C objects in the deamon? Or should I save them as JSON strings?

For JSON serialization, I'm thinking of using one of the C souce from here: http://www.json.org/

either:
http://oss.metaparadigm.com/json-c/
or
http://fara.cs.uni-potsdam.de/~jsg/json_parser/

These files are however *.c and *.h? How do I compile them and use them in my code?

>>These files are however *.c and *.h? How do I compile them
use a c compiler, such as gcc (*nix) or one of the many c compilers available on ms-windows.

Who to use them once compiled? I have not the slightest clue.

looks like you're on a Linux platform, yes? so you should have the Gnu C Compiler (gcc) available.

put the files you want to compile in one directory, and invoke the GCC compiler like so

gcc -o <binaryName> <source1.c> <source2.c> <...>

where binaryName is an arbitrary name of the compiled binary file, that will be compiled from the source code.

for example, http://www.json.org/JSON_checker/ ... has three files: JSON_checker.c, JSON_checker.h, main.c

the header file (.h) is #include by both of the .c files, so if it's in the directory that you compile in, it should be found automatically.

compile it into a program called "checker" by placing all three of the files in a directory, then invoke gcc, like so:

% gcc -o checker main.c JSON_checker.c

to run the program, you would call it from the directory

% ./checker

this particular program requires an argument to be passed, a file that will be checked for correct JSON syntax. so you will get their example files, or create one yourself, and pass the filename as argument to the program

% ./checker test/pass1.json

(see comment from the "main.c" file)

Thanks for the good info.

I realize my question was a bit too basic. I'm reading the great list of C resources in the sticky at the top of the forum.

If I run into problems I'll be sure to share.

Thanks again for the help thus far.

i remember the frustration of being versed in a couple languages, but not knowing where the hell to start when faced with another language i'd never used.

:P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.