flare コマンド
memcacheと同じみたいです。
http://l-w-i.net/t/memcached/command_001.txt
よくつかうもの
stats
statsnodes
set key1 0 0 4
test
get key1
ファイル名一括置換
for f in *.gif; do mv $f `echo $f|sed -e "s/img_//g"`; done
メモです。
挙動がおかしい気が。。
YiiでCLIを作成
コンソールアプリケーションが相当するみたいです。
エントリポイントを作成
/projectname/system/protected/bin/batch/entrypoint.php
<?php defined('YII_DEBUG') or define('YII_DEBUG',true); // change the following paths if necessary $yii=dirname(__FILE__).'/../../../yii/framework/yii.php'; // env $env = (isset($_SERVER['SERVER_STATUS'])) ? $_SERVER['SERVER_STATUS'] : '';// env setting define('MAIN_CONFIG',dirname(__FILE__).'/../../../protected/config/console.php'); $config= MAIN_CONFIG; if( $env && file_exists(dirname(__FILE__).'/../../../protected/config/environments/'.$env.'.php') ){ $config=dirname(__FILE__).'/../../protected/config/environments/'.$env.'.php'; // config over write include dirname(__FILE__).'/../../protected/config/environments/'.$env.'_settings.php'; } require_once($yii); Yii::createConsoleApplication($config)->run();
実際のコマンドをかくファイルを作成
/projectname/system/protected/commands/JissainoCommand.php
<?php class JissainoCommand extends CConsoleCommand { public function run($args) { var_dump(__LINE__); exit; } }
たたいてみます
$ pwd /home/katano/public_html/projectname/system/protected/bin/batch $ php entrypoint.php Yii command runner (based on Yii v1.1.3) Usage: set.php <command-name> [parameters...] The following commands are available: - jissaino To see individual command help, use the following: set.php help <command-name>
実際にたたいてみます
$ php entrypoint.php jissaino int(7)
できました。
Way Back Machine で各種ソーシャルサイトまとめ
2001年3月
http://web.archive.org/web/20010302103333/http://www.twitter.com/
あれ?twitterって2006年だったような。。
ジャック・ドーシーによると、Twitterの基本構想は自身が2000年6月に思いついた[9]。
http://ja.wikipedia.org/wiki/Twitter
プロトタイプが2001年にあったのでしょうか。
それにしてはフッターが2007年になっているし。。なんでしょうかこれ。
■Google
1998年11月
http://web.archive.org/web/19981111184551/http://google.com/
1998年12月
http://web.archive.org/web/19981202230410/http://www.google.com/
おおお
1998年9月7日 - アンディ・ベクトルシャイムからの10万ドルの資金援助を受け、カリフォルニア州メンロパークにある友人のアパートで創業。その後短期間のうちに100万ドルの資本を集める。
http://ja.wikipedia.org/wiki/Google
このころですね。
■Mixi
2004年6月
なつかしい。
■facebook
画面なし
なにか対策をとっていたのでしょうか。
http://web.archive.org/web/*/facebook.com
2002年3月
http://web.archive.org/web/20020328012821/http://www.example.com/
意外というか予想通りというか。
Flareをつかってみます・2
さらにテストです。
/home/katano/public_html/projectname/htdocs/flare_test.php
<?php $memcache = new Memcache; $memcache->connect('localhost', 12121) or die ("Can't connect"); $memcache->set('key', "1", false, 30); $memcache->set('key2', "2", false, 30); $memcache->set('key3', "3", false, 30); $memcache->set('key4', "4", false, 30); $memcache->set('key5', "5", false, 30); $memcache->set('key6', "6", false, 30); var_dump($memcache->get('key5'));
結果
string(1) "5"
とれているっぽいです。
こうかくと.htaccessの記述は必要ないです。
あと
<?php $memcache = new Memcache; $memcache->connect('localhost', 12121) or die ("Can't connect"); // $memcache->set('key', "1", false, 30); // $memcache->set('key2', "2", false, 30); // $memcache->set('key3', "3", false, 30); // $memcache->set('key4', "4", false, 30); // $memcache->set('key5', "5", false, 30); // $memcache->set('key6', "6", false, 30); var_dump($memcache->get('key5'));
でも
結果
string(1) "5"
が返ってくるのが新鮮です。(30秒以内)
参考
http://d.hatena.ne.jp/kovaio/20060313
http://www.php.net/manual/ja/memcache.connect.php
Flareをつかってみます
すでにサーバーにFlareがインストールされていましたのでインストール部は割愛いたします。
Flareの設定を確認
$ less /etc/flarei.con data-dir = /tmp log-facility = local0 max-connection = 256 monitor-threshold = 3 monitor-interval = 1 server-name = localhost server-port = 12120 thread-pool-size = 8
Flareの設定に従って.htaccessに以下を追記
/home/katano/public_html/projectname/htdocs/.htaccess
php_value session.save_handler memcache php_value session.save_path "localhost:12121"
テスト用のスクリプトを設置
/home/katano/public_html/projectname/htdocs/phpinfo.php
<?php phpinfo();
確認
session.save_handler memcache files session.save_path localhost:12121 no value
大丈夫そうです。
/home/katano/public_html/projectname/htdocs/flare_test.php
<?php session_start(); var_dump($_SESSION); if(! isset($_SESSION['count'])){ $_SESSION['count'] = 1; } else { $_SESSION['count'] = $_SESSION['count'] + 1; }
ページにアクセス
array(0) { }
更新
array(1) { ["count"]=> int(1) }
更新
array(1) { ["count"]=> int(2) }
更新
array(1) { ["count"]=> int(3) }
カウントアップされています。。