<?php

class FileStorage {

	private static $instances;
	 
	var $storageDirectory;
	var $storageFileExtension = "txt";
	var $fastAccessArray;	

	var $data

	public function getInstance($key){
	}
	setStorageDirectory($dir)
	self
	
	public function __construct($storageFilePath){
	 	self::$indexesDirectory = $iDir;
		self::$lastArray = array();	
		
		$this->storageFilePath = $storageFilePath;
	}
	
	// set storage file path
	public function setStorageFilePath($storageFilePath){
		$this->storageFilePath = $storageFilePath;
	}
	
	// protected
	protected function getFileContent(){
		
	}
	
	protected function setFileContent($content, $disableSave=false){

	}
	
	public static function getArray($fileName, $forceRead=false){
	 	if (isset(self::$lastArray[$fileName]) &&  is_array(self::$lastArray[$fileName])  && $forceRead==false){
	 		reset(self::$lastArray[$fileName]);
	 		return  self::$lastArray[$fileName];
	 	}
		$content = Util::readFile($storageFilePath);
		if($content===false) $content = serialize(array());
		return unserialize($content);
		
	}
	
	public static function setArray($fileName, $arr, $disableSave=false){
		self::$lastArray[$fileName] = $arr;
		$content = serialize($arr);
		if(!$disableSave){
			Util::writeFile($filePath, $content);
		}
	}
	
	
	

 	private static $indexesDirectory;
	private static $lastArray;
	private static $disableSave;
	
	function FileStorage($iDir){
		self::$indexesDirectory = $iDir;
		self::$lastArray = array();	
	}<?php

class Indexes {
 
 	private static $indexesDirectory;
	private static $lastArray;
	private static $disableSave;
	
	function Indexes($iDir){
		self::$indexesDirectory = $iDir;
		self::$lastArray = array();	
	}