Skip to content

Commit

Permalink
Update LaravelTwStreetname.php
Browse files Browse the repository at this point in the history
  • Loading branch information
seta0909 committed Jan 15, 2015
1 parent 19a8e0d commit 759e745
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Seta0909/LaravelTwStreetname/LaravelTwStreetname.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ private static function getInstance()
}
else
{
self::$cache = 'none';
session_start();
self::$cache = 'session';
self::$originData = $_SESSION['LaravelTwStreetnameOrigin'];
self::$citys = $_SESSION['LaravelTwStreetnameCitys'];
self::$countrys = $_SESSION['LaravelTwStreetnameCountrys'];
self::$streets = $_SESSION['LaravelTwStreetnameStreets'];
self::$zipCode = $_SESSION['LaravelTwStreetnameZipCode'];
}

//載入街道Json資料
Expand All @@ -44,6 +50,8 @@ private static function getInstance()
if(self::$cache=='apcache' && count(self::$originData) > 0)
{
apc_store('LaravelTwStreetnameOrigin', self::$originData);
}else{
$_SESSION['LaravelTwStreetnameOrigin'] = self::$originData;
}

}
Expand All @@ -59,6 +67,8 @@ private static function getInstance()
if(self::$cache=='apcache' && count(self::$zipCode) > 0)
{
apc_store('LaravelTwStreetnameZipCode', self::$zipCode);
}else{
$_SESSION['LaravelTwStreetnameZipCode'] = self::$zipCode;
}
}

Expand All @@ -73,6 +83,8 @@ private static function getInstance()
if(self::$cache=='apcache' && count(self::$citys) > 0)
{
apc_store('LaravelTwStreetnameCitys', self::$citys);
}else{
$_SESSION['LaravelTwStreetnameCitys'] = self::$citys;
}
}
//載入鄉鎮區
Expand All @@ -83,6 +95,8 @@ private static function getInstance()
if(self::$cache=='apcache' && count(self::$countrys) > 0)
{
apc_store('LaravelTwStreetnameCountrys', self::$countrys);
}else{
$_SESSION['LaravelTwStreetnameCountrys'] = self::$countrys;
}
}
//載入街道
Expand All @@ -98,6 +112,8 @@ private static function getInstance()
if(self::$cache=='apcache' && count(self::$streets) > 0)
{
apc_store('LaravelTwStreetnameStreets', self::$streets);
}else{
$_SESSION['LaravelTwStreetnameStreets'] = self::$streets;
}
}
}
Expand Down

0 comments on commit 759e745

Please sign in to comment.