1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace Jobs\Cache;
- use Mall\Framework\Factory;
- class AllTableNameCache
- {
-
- static $allTableName = 'all_tablename';
-
- static function allTableNameCacheIsExists($databaseName){
- $result = Factory::cache('default')->has(self::$allTableName.'::'.$databaseName);
- return $result;
- }
-
- static function allTableNameCache($databaseName, $allTableNameData)
- {
- if(empty($allTableNameData)){
- return false;
- }
- $pipe = Factory::cache('default')->multi();
- foreach ($allTableNameData as $key => $value){
- $writeCache = Factory::cache('default')->sadd(self::$allTableName.'::'.$databaseName, $value['TABLE_NAME']);
- }
- $pipe->exec();
- }
-
- static function TableIsExists($databaseName, $tableName)
- {
- $result = Factory::cache('default')->sismember(self::$allTableName.'::'.$databaseName, $tableName);
- return $result;
- }
-
- static function addNewTableName($databaseName, $tableName){
- $writeCache = Factory::cache('default')->sadd(self::$allTableName.'::'.$databaseName, $tableName);
- return $writeCache;
- }
- }
|