コード例 #1
0
        void ConfigureFileSource()
        {
            _fileSource = new CachingWebFileSource(_configuration.AccessToken, _configuration.GetMapsSkuToken, _configuration.AutoRefreshCache)
                          .AddCache(new MemoryCache(_configuration.MemoryCacheSize))
#if !UNITY_WEBGL
                          .AddCache(new SQLiteCache(_configuration.FileCacheSize))
#endif
            ;
        }
コード例 #2
0
ファイル: MapboxAccess.cs プロジェクト: jegusquiza/Unity_mapa
        /// <summary>
        /// Clear all existing tile caches. Deletes MBTiles database files.
        /// </summary>
        public void ClearSceneCache()
        {
            CachingWebFileSource cwfs = _fileSource as CachingWebFileSource;

            if (null != cwfs)
            {
                cwfs.Clear();
            }
        }
コード例 #3
0
        void ConfigureFileSource()
        {
            _fileSource = new CachingWebFileSource(_configuration.AccessToken)
                          .AddCache(new MemoryCache(_configuration.MemoryCacheSize))
#if !UNITY_WEBGL
                          .AddCache(new MbTilesCache(_configuration.MbTilesCacheSize))
#endif
            ;
        }
コード例 #4
0
        public void ClearAllCacheFiles()
        {
            // explicity call Clear() to close any connections that might be referenced by the current scene
            CachingWebFileSource cwfs = _fileSource as CachingWebFileSource;

            if (null != cwfs)
            {
                cwfs.Clear();
            }

            // remove all left over files (eg orphaned .journal) from the cache directory
            string cacheDirectory = Path.Combine(Application.persistentDataPath, "cache");

            if (!Directory.Exists(cacheDirectory))
            {
                return;
            }

            foreach (var file in Directory.GetFiles(cacheDirectory))
            {
                try
                {
                    File.Delete(file);
                }
                catch (Exception deleteEx)
                {
                    Debug.LogErrorFormat("Could not delete [{0}]: {1}", file, deleteEx);
                }
            }

            //reinit caches after clear
            if (null != cwfs)
            {
                cwfs.ReInit();
            }

            Debug.Log("done clearing caches");
        }
コード例 #5
0
 void ConfigureFileSource()
 {
     _fileSource = new CachingWebFileSource(_accessToken).AddCache(new MemoryCache(500));
 }