Skip to content

Instantly share code, notes, and snippets.

@kenzo0107
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenzo0107/365890fe3fd6e44c1fc2 to your computer and use it in GitHub Desktop.
Save kenzo0107/365890fe3fd6e44c1fc2 to your computer and use it in GitHub Desktop.
<?php
$memcache = new Memcache;
$memcache->connect( 'localhost', 11211 ) or die ( "Could not connect" );
$cache_key = 'test';
$cache_data = array( 'hoge', 1, array( 1, "text" ) );
# キャッシュ書き込み
$memcache->set( $cache_key, $cache_data, 0, $expire );
# キャッシュ取得
$data = $memcache->get( $cache_key );
var_dump( $data );
# キャッシュ削除
$memcache->delete( $cache_key );
$data = $memcache->get( $cache_key );
var_dump( $data );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment