Skip to content

Commit 19a8e0d

Browse files
committed
Update LaravelTwStreetname.php
1 parent 44ac458 commit 19a8e0d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Seta0909/LaravelTwStreetname/LaravelTwStreetname.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private static function getInstance()
4141
if (!is_array(self::$originData)) {
4242
$streetString = file_get_contents(dirname(__FILE__) . "/address_data.json");
4343
self::$originData = json_decode($streetString, true);
44-
if(self::$cache=='apcache')
44+
if(self::$cache=='apcache' && count(self::$originData) > 0)
4545
{
4646
apc_store('LaravelTwStreetnameOrigin', self::$originData);
4747
}
@@ -56,7 +56,7 @@ private static function getInstance()
5656
$temp[$val['country']] = $val['mailcode'];
5757
}
5858
self::$zipCode = $temp;
59-
if(self::$cache=='apcache')
59+
if(self::$cache=='apcache' && count(self::$zipCode) > 0)
6060
{
6161
apc_store('LaravelTwStreetnameZipCode', self::$zipCode);
6262
}
@@ -70,7 +70,7 @@ private static function getInstance()
7070
self::$citys[] = $val;
7171
}
7272
}
73-
if(self::$cache=='apcache')
73+
if(self::$cache=='apcache' && count(self::$citys) > 0)
7474
{
7575
apc_store('LaravelTwStreetnameCitys', self::$citys);
7676
}
@@ -80,7 +80,7 @@ private static function getInstance()
8080
foreach (self::$citys as $key => $val) {
8181
self::$countrys[$val['uid']] = self::searchLink($val['uid']);
8282
}
83-
if(self::$cache=='apcache')
83+
if(self::$cache=='apcache' && count(self::$countrys) > 0)
8484
{
8585
apc_store('LaravelTwStreetnameCountrys', self::$countrys);
8686
}
@@ -95,7 +95,7 @@ private static function getInstance()
9595
}
9696
}
9797
}
98-
if(self::$cache=='apcache')
98+
if(self::$cache=='apcache' && count(self::$streets) > 0)
9999
{
100100
apc_store('LaravelTwStreetnameStreets', self::$streets);
101101
}

0 commit comments

Comments
 (0)