Skip to content

This is a library for accessing LightCloud systems through PHP.

Notifications You must be signed in to change notification settings

KnightE/litecloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LiteCloud Library for PHP

This is a library for accessing LightCloud systems through PHP.

Background

LightCloud is a distributed key-value stored open-sourced by Plurk. The official website which includes benchmarks, design specs, and more can be viewed at the following URL:

http://opensource.plurk.com/LightCloud/

Usage

You can use it with class methods:


require 'LiteCloud.php';

$config = array(
	'classes' => array(
		'storage' 	=> 'LiteCloud_Tyrant',
	),
	'nodes' => array(	
		'lookup1_A' => array('127.0.0.1:41201', '127.0.0.1:41202'),
		'lookup1_B' => array('127.0.0.1:51201', '127.0.0.1:51202'),

		'storage1_A' => array('127.0.0.1:44201', '127.0.0.1:44202',),
		'storage1_B' => array('127.0.0.1:54201', '127.0.0.1:54202',),
	),
);

LiteCloud::init($config);

LiteCloud::set('hello', 'world');
print LiteCloud::get("hello"); # => world
LiteCloud::delete("hello");

print LiteCloud::get("hello"); # => nil

Or you can also use it with instances:


require 'LiteCloud.php';

$config = array(
	'nodes' => array(	
		'lookup1_A' => array('127.0.0.1:41201', '127.0.0.1:41202'),
		'lookup1_B' => array('127.0.0.1:51201', '127.0.0.1:51202'),

		'storage1_A' => array('127.0.0.1:44201', '127.0.0.1:44202',),
		'storage1_B' => array('127.0.0.1:54201', '127.0.0.1:54202',),
	),
);

$cloud = new LiteCloud($config);

$cloud->set('hello', 'world');
print $cloud->get("hello"); # => world
$cloud->delete("hello");

print $cloud->get("hello"); # => nil

Dependence

sudo pecl install memcached

Known Issues / To-Do

The python library actually caches the get/set values in a thread-local hash table. This library won't do this now.

About

This is a library for accessing LightCloud systems through PHP.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published