<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
		<id>https://wiki.nonip.net/index.php?action=history&amp;feed=atom&amp;title=Php%2Fredis%2Fhelloworld</id>
		<title>Php/redis/helloworld - 変更履歴</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.nonip.net/index.php?action=history&amp;feed=atom&amp;title=Php%2Fredis%2Fhelloworld"/>
		<link rel="alternate" type="text/html" href="https://wiki.nonip.net/index.php?title=Php/redis/helloworld&amp;action=history"/>
		<updated>2026-04-18T03:03:46Z</updated>
		<subtitle>このウィキのこのページに関する変更履歴</subtitle>
		<generator>MediaWiki 1.24.2</generator>

	<entry>
		<id>https://wiki.nonip.net/index.php?title=Php/redis/helloworld&amp;diff=21598&amp;oldid=prev</id>
		<title>Admin: /* セッションハンドラに使う */</title>
		<link rel="alternate" type="text/html" href="https://wiki.nonip.net/index.php?title=Php/redis/helloworld&amp;diff=21598&amp;oldid=prev"/>
				<updated>2026-04-10T07:01:34Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;セッションハンドラに使う&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;←前の版&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2026年4月10日 (金) 07:01時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;行44:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;行44:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==セッションハンドラに使う==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==セッションハンドラに使う==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ini_set('session.save_handler', 'redis');&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ini_set('session.save_path', &amp;quot;localhost:6379?persistent=1&amp;amp;weight=1&amp;amp;timeout=1&amp;amp;retry_interval=2&amp;quot;);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;2台構成とかの場合。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; session.save_handler = redis&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; session.save_handler = redis&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; session.save_path = &amp;quot;tcp://host1:6379?weight=1, tcp://host2:6379?weight=2&amp;amp;timeout=2.5, tcp://host3:6379?weight=2&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; session.save_path = &amp;quot;tcp://host1:6379?weight=1, tcp://host2:6379?weight=2&amp;amp;timeout=2.5, tcp://host3:6379?weight=2&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>https://wiki.nonip.net/index.php?title=Php/redis/helloworld&amp;diff=116&amp;oldid=prev</id>
		<title>127.0.0.1: ページの作成:「==取得＆格納==  $redis = new Redis();  $redis-&gt;connect('127.0.0.1', 6379);  // $redis-&gt;connect('127.0.0.1', 6379, 2.5); // 2.5 sec timeout.  $redis-&gt;set('key1', 'hog...」</title>
		<link rel="alternate" type="text/html" href="https://wiki.nonip.net/index.php?title=Php/redis/helloworld&amp;diff=116&amp;oldid=prev"/>
				<updated>2015-05-19T17:59:15Z</updated>
		
		<summary type="html">&lt;p&gt;ページの作成:「==取得＆格納==  $redis = new Redis();  $redis-&amp;gt;connect(&amp;#039;127.0.0.1&amp;#039;, 6379);  // $redis-&amp;gt;connect(&amp;#039;127.0.0.1&amp;#039;, 6379, 2.5); // 2.5 sec timeout.  $redis-&amp;gt;set(&amp;#039;key1&amp;#039;, &amp;#039;hog...」&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==取得＆格納==&lt;br /&gt;
 $redis = new Redis();&lt;br /&gt;
 $redis-&amp;gt;connect('127.0.0.1', 6379);&lt;br /&gt;
 // $redis-&amp;gt;connect('127.0.0.1', 6379, 2.5); // 2.5 sec timeout.&lt;br /&gt;
 $redis-&amp;gt;set('key1', 'hoge');&lt;br /&gt;
 print $redis-&amp;gt;get('key1'); // hoge&lt;br /&gt;
&lt;br /&gt;
==有効時間を決めて格納==&lt;br /&gt;
 $redis-&amp;gt;setex('key2', 10, 'hoge_10秒だけ保持');&lt;br /&gt;
 print $redis-&amp;gt;get('key2');&lt;br /&gt;
&lt;br /&gt;
==削除==&lt;br /&gt;
 $redis-&amp;gt;delete('key1');&lt;br /&gt;
 $redis-&amp;gt;delete('key1', 'key2'); // 一括指定も可能&lt;br /&gt;
&lt;br /&gt;
==リスト追加==&lt;br /&gt;
 $redis-&amp;gt;rPush('key1', 'A');&lt;br /&gt;
 $redis-&amp;gt;rPush('key1', 'B');&lt;br /&gt;
&lt;br /&gt;
==前方追加==&lt;br /&gt;
 $redis-&amp;gt;lPush('key1', 'C');&lt;br /&gt;
&lt;br /&gt;
==リスト全取得==&lt;br /&gt;
 $redis-&amp;gt;rPush('key1', 'A');&lt;br /&gt;
 $redis-&amp;gt;rPush('key1', 'B');&lt;br /&gt;
 $redis-&amp;gt;rPush('key1', 'C');&lt;br /&gt;
 $redis-&amp;gt;lRange('key1', 0, -1); /* array('A', 'B', 'C') */&lt;br /&gt;
 $redis-&amp;gt;lSize('key1');/* 3 */&lt;br /&gt;
&lt;br /&gt;
==ランク取得==&lt;br /&gt;
 $redis-&amp;gt;delete('z');&lt;br /&gt;
 $redis-&amp;gt;zAdd('key', 1, 'one');&lt;br /&gt;
 $redis-&amp;gt;zAdd('key', 2, 'two');&lt;br /&gt;
 $redis-&amp;gt;zRank('key', 'one'); /* 0 */&lt;br /&gt;
 $redis-&amp;gt;zRank('key', 'two'); /* 1 */&lt;br /&gt;
 $redis-&amp;gt;zRevRank('key', 'one'); /* 1 */&lt;br /&gt;
 $redis-&amp;gt;zRevRank('key', 'two'); /* 0 */&lt;br /&gt;
&lt;br /&gt;
==ソート取得==&lt;br /&gt;
 $redis-&amp;gt;delete('z');&lt;br /&gt;
 $redis-&amp;gt;zAdd('key', 1, 'one');&lt;br /&gt;
 $redis-&amp;gt;zAdd('key', 2, 'two');&lt;br /&gt;
 var_dump($redis-&amp;gt;zRange('key', 0, -1); //Array ( [0] =&amp;gt; one [1] =&amp;gt; two )&lt;br /&gt;
&lt;br /&gt;
==セッションハンドラに使う==&lt;br /&gt;
 session.save_handler = redis&lt;br /&gt;
 session.save_path = &amp;quot;tcp://host1:6379?weight=1, tcp://host2:6379?weight=2&amp;amp;timeout=2.5, tcp://host3:6379?weight=2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==キーリスト取得==&lt;br /&gt;
 $redis-&amp;gt;set('user1', 1);&lt;br /&gt;
 $redis-&amp;gt;set('user2', 2);&lt;br /&gt;
 $redis-&amp;gt;set('user3', 3);&lt;br /&gt;
 $redis-&amp;gt;set('test', 10);&lt;br /&gt;
 var_dump($redis-&amp;gt;keys('user*')); // array(3) { [0]=&amp;gt; string(5) &amp;quot;user1&amp;quot; [1]=&amp;gt; string(5) &amp;quot;user2&amp;quot; [2]=&amp;gt; string(5) &amp;quot;user3&amp;quot; }&lt;/div&gt;</summary>
		<author><name>127.0.0.1</name></author>	</entry>

	</feed>