Index: /lang/php/Cache/trunk/Cache/Handler.php
===================================================================
--- /lang/php/Cache/trunk/Cache/Handler.php (revision 6360)
+++ /lang/php/Cache/trunk/Cache/Handler.php (revision 6899)
@@ -41,5 +41,5 @@
 	}
 	public function CacheItem($id){
-		return new Cache_Handler_Item($id,&$this);
+		return new Cache_Handler_Item($id,$this);
 	}
 	public function setResource(&$res){//参照渡し
@@ -82,5 +82,5 @@
 		$this->readCache($id);
 		$data = $this->temp;
-		//有効期限切れを調べる
+		//有効期限を調べる
 		//TODO::有効期限切れを調べるモジュールを作る
 		//http://www.gnu.org/software/tar/manual/html_node/tar_109.html
@@ -100,6 +100,6 @@
 		}
 		//有効期限切れかどうかチェックする
-		//期限内なら　TRUE　それ以外は　FALSE
-		return time() < $time_to_expired;
+		//期限内なら　FALSE　それ以外は　TRUE
+		return time() > $time_to_expired;
 	}
 	public function isExists($id){
@@ -118,5 +118,5 @@
 		//$this->readCache($id);//Tempに読み込む
 		//$this->temp["modifed"] = $date;
-		//$this->updateCache($id);
+		//$this->updateCache($id);//このメソッドを使うとキャッシュ保存、TTL保存,Modfied保存,Group保存の4処理が動くので注意
 	//}
 	////for maintenance
@@ -133,6 +133,8 @@
 	public function GroupNames(){
 		//キャッシュに設定しているグループ名一覧を返す
+		//2008/02/01 追加API
 		return $this->resource->getGroupNameList();
 	}
+	//キャッシュを削除する系
 	public function clear($id){
 		return $this->resource->remove($id);
@@ -146,5 +148,5 @@
 		//プラグインを引っかける
 		$content =  $this->beforeWrite( $data );
-		//保存
+		//Resouceへ保存
 		$ret = $this->resource->save( $content, $id );
 		return $ret;
Index: /lang/php/Cache/trunk/Cache/Handler/Item.php
===================================================================
--- /lang/php/Cache/trunk/Cache/Handler/Item.php (revision 6360)
+++ /lang/php/Cache/trunk/Cache/Handler/Item.php (revision 6899)
@@ -26,5 +26,5 @@
 		return $this->handler->isExists($id);
 	}
-	//alias to isExists
+	//alias to isExists()
 	//この名前の方がソースの可読性が上がると思う
 	public function available(){
Index: /lang/php/Cache/trunk/Cache/Handler/Resource/File.php
===================================================================
--- /lang/php/Cache/trunk/Cache/Handler/Resource/File.php (revision 6360)
+++ /lang/php/Cache/trunk/Cache/Handler/Resource/File.php (revision 6899)
@@ -304,5 +304,5 @@
      * まだテストしていない
      */
-    public function getGroupNameList(){
+    public function getGroupNameList() {
     	$list = $this->getGroupList();
     	function fetch($keys=array(),$line){
@@ -416,5 +416,5 @@
     * @param  String $id cache id
     * @param  String $group Cache group name
-    * @return boolean  true (succeeded) / false (faild)
+    * @retursn boolean  true (succeeded) / false (faild)
     */
     private function _leaveGroup( $id, $group = null )
@@ -442,10 +442,24 @@
     }
     
+    
     /** 
     * manage last modified 
-    */
-    
-    
-    /** 
+    *
+    *
+    *
+    *
+    */
+
+    /** 
+    * return file name(including path)
+    * @access private
+    * @return String filename
+    */
+    private function _getModifiedListFileName()
+    {
+        $filename = "modified";
+        return $this->getFilePath()."/".$filename.$this->_ext;
+    }
+        /** 
     * get index
     * @access public
@@ -454,15 +468,18 @@
     public function getModifiedList()
     {
-        $lines = @file_get_contents( $this->_getModifiedListFileName() );
-        $array = array();
-        foreach( explode( "\n", $lines ) as $line ){
-            if( $line == "" ){
-                continue;
-            }
-            $buff =  explode( ",", $line );
-            $array[$buff[0]] = $buff[1];
-        }
-        return $array;
-    }
+    	return $this->_getModifiedList();
+        //$lines = @file_get_contents( $this->_getModifiedListFileName() );
+        //$array = array();
+        //foreach( explode( "\n", $lines ) as $line ){
+            //if( $line == "" ){
+                //continue;
+            //}
+            //$buff =  explode( ",", $line );
+            //$array[$buff[0]] = $buff[1];
+        //}
+        //return $array;
+    }
+    //Idがセットされていたらそれだけを返す
+    //IDがNullの場合は全データを返す。
     /** 
     * @access private
@@ -470,9 +487,22 @@
     * @return String date, last modified 
     */
-    private function _getModified( $id )
-    {
-        $list = $this->getModifiedList();
-        return $list[$id];
-    }
+    private function _getModified( $id = null ){
+    	$arr = array();
+    	//file_get_csvに書き換え
+    	$lists = file_get_csv( $this->_getModifiedListFileName() );
+    	foreach( $lists as $list ){
+    		//IDのデータが見つかったらそれだけを返す。
+    		if( $id !== null && $id == $list[0] ){
+    			return $list[1];
+    		}
+    		$arr[$list[0]] = $list[1];
+    	}
+    	return $arr;
+    }
+    //private function _getModified( $id )
+    //{
+        //$list = $this->getModifiedList();
+        //return $list[$id];
+    //}
     /** 
     * @access private
@@ -488,16 +518,5 @@
     
     }
-    
-    /** 
-    * return file name(including path)
-    * @access private
-    * @return String filename
-    */
-    private function _getModifiedListFileName()
-    {
-        $filename = "modified";
-        return $this->getFilePath()."/".$filename.$this->_ext;
-    }
-    
+
     /** 
     * remove cache id 's modified record.
@@ -521,13 +540,18 @@
     public function saveModifiedList( $list )
     {
-        $str = "";
-        foreach( $list as $id => $var ){
-            $id   = str_replace( ",", "", $id );
-            $var  = str_replace( ",", "", $var );
-            $str .= "{$id},{$var}\n";
-        }
-        $size = file_put_contents( $this->_getModifiedListFileName(), $str );
-        return ( $size > 0 );
-    }
+    	return file_put_csv( $this->_getModifiedListFileName(), $list );
+        //$str = "";
+        //foreach( $list as $id => $var ){
+            //$id   = str_replace( ",", "", $id );
+            //$var  = str_replace( ",", "", $var );
+            //$str .= "{$id},{$var}\n";
+        //}
+        //$size = file_put_contents( $this->_getModifiedListFileName(), $str );
+        //return ( $size > 0 );
+    }
+    
+    
+    
+    //有効期限関連の処理
     //time to live
     /**
@@ -537,20 +561,26 @@
     public function getLifeTimeList()
     {
+    	return $this->_getLifeTimeList();
+    }
+    /** 
+    * @access private
+    * @param  Stirng $id cache id
+    * @return int time, time to live 
+    */
+    public function getLifeTime( $id )
+    {
+        return $this->_getLifeTimeList( $id );
+    }
+    public function _getLifeTimeList($id=null)
+    {
         $lines = file_get_csv( $this->getLifeTimeFileName() );
         $array = array();
         foreach( $lines as $idx => $line ){
+        	if( $id!==null && $id == $line[0] ){
+        		return $line
+        	}
             $array[$line[0]] = $line[1];
         }
         return $array;
-    }
-    /** 
-    * @access private
-    * @param  Stirng $id cache id
-    * @return int time, time to live 
-    */
-    public function getLifeTime( $id )
-    {
-        $list = $this->getLifeTimeList();
-        return $list[$id];
     }
     /** 
@@ -599,12 +629,13 @@
     public function saveLifeTimeList( $list )
     {
-        $str = "";
-        foreach( $list as $id => $var ){
-            $id   = str_replace( ",", "", $id );
-            $var  = str_replace( ",", "", $var );
-            $str .= "{$id},{$var}\n";
-        }
-        $size = file_put_contents( $this->getLifeTimeFileName(), $str );
-        return ( $size > 0 );
+    	return file_put_csv( $list, $this->_getModifiedListFileName() );
+        //$str = "";
+        //foreach( $list as $id => $var ){
+            //$id   = str_replace( ",", "", $id );
+            //$var  = str_replace( ",", "", $var );
+            //$str .= "{$id},{$var}\n";
+        //}
+        //$size = file_put_contents( $this->getLifeTimeFileName(), $str );
+        //return ( $size > 0 );
     }
 }
Index: /lang/php/Cache/trunk/Cache/Handler/Resource/Interface.php
===================================================================
--- /lang/php/Cache/trunk/Cache/Handler/Resource/Interface.php (revision 5458)
+++ /lang/php/Cache/trunk/Cache/Handler/Resource/Interface.php (revision 6899)
@@ -3,4 +3,7 @@
 /** 
  * Resource Interface definition for Cache_Handler
+ * ここに書いているメソッドはどうやっても実装しておく。
+ * メソッドの動作定義がわからなくなったときのため
+ * なにかメソッドを追加したら必ずここを更新する。
  * @package     Cache_Handler
  * @category    Cache
@@ -66,14 +69,14 @@
     */
     public function setLastModified( $id, $date );
-//  /** 
-//  * Call by hander.
-//  * definition of isExists method.
-//  * check cache exists.
-//  * @access public
-//  * @param $id    stirng cache id
-//  * @return boolean  true (exists) / false (not exists)
-//  */
-//  public function isExists( $id );
-//  
+  ///** 
+  //* Call by hander.
+  //* definition of isExists method.
+  //* check cache exists.
+  //* @access public
+  //* @param $id    stirng cache id
+  //* @return boolean  true (exists) / false (not exists)
+  //*/
+  //public function isExists( $id );
+ // 
     /** 
     * Call by hander.
@@ -115,3 +118,12 @@
     */
     public function addIntoGroup( $id, $group );
+    
+    /**
+     * Call by Handler.
+     * definition function.
+     * @access public
+     * @param null
+     * @return Array of String 
+     */
+    public function getGroupNameList();
 }
Index: /lang/php/Cache/ReadMe.txt
===================================================================
--- /lang/php/Cache/ReadMe.txt (revision 6248)
+++ /lang/php/Cache/ReadMe.txt (revision 6899)
@@ -20,3 +20,16 @@
 
 
+//そもそもキャッシュをなんに使うか。
+//MVCの三層構造+RESTfulにすると４層でわかりにくい
+RESTfulなURLを構造として持っておき
+URLに紐付くデータをキャッシュとして保存しておく
+{cache_key =>URL, cache_data=> object}
+のを作り、ユーザーはobjectへHTTPメソッド操作をするようにする。
+そういうイメージで２層構造＋バックエンドの３層構造をイメージ。
 
+
+Wikiなどを見ている限り、MVC三層構造は不便だと感じる。
+RESTfulでURLがデータIDを示す構造が便利だと感じている。
+
+キャッシュのキーをURNにすることで、このような構造を簡単に作れるはず。
+
