public ShellPageRendererTracker(IShellContext context) { _context = context; _nSCache = new NSCache(); _context.Shell.PropertyChanged += HandleShellPropertyChanged; _fontManager = context.Shell.RequireFontManager(); }
public ImageCacheManager() { imageCache = new NSCache { Name = "ImageCacheManager", CountLimit = 20, // Max 20 images in memory. TotalCostLimit = 10 * 1024 * 1024 // Max 10MB used. }; }
/// <summary> /// Initializes a new instance of the Cache class. /// </summary> /// <param name="cachePercentageSize">The percentage of total physical memoery that the cache will be allowed to grow.</param> protected Cache(float cachePercentageSize) { if (cachePercentageSize >= 1.0f) { throw new ArgumentOutOfRangeException(nameof(cachePercentageSize), "The percentage size must be less than 1.0f."); } this.cache = new NSCache(); this.cache.TotalCostLimit = (nuint)(NSProcessInfo.ProcessInfo.PhysicalMemory * cachePercentageSize); }
private ImageCache(int maxCacheSize) { _cache = new NSCache(); _cache.TotalCostLimit = (nuint)(NSProcessInfo.ProcessInfo.PhysicalMemory * 0.2); // 20% of physical memory // Can't use minilogger here, we would have too many dependencies decimal sizeInMB = System.Math.Round((decimal)_cache.TotalCostLimit/(1024*1024), 2); System.Diagnostics.Debug.WriteLine(string.Format("LruCache size: {0}MB", sizeInMB)); // if we get a memory warning notification we should clear the cache NSNotificationCenter.DefaultCenter.AddObserver(new NSString("UIApplicationDidReceiveMemoryWarningNotification"), notif => Clear()); }
public ShellPageRendererTracker(IShellContext context) { _context = context; _nSCache = new NSCache(); _context.Shell.PropertyChanged += HandleShellPropertyChanged; if (_context.Shell.Toolbar != null) { _context.Shell.Toolbar.PropertyChanged += OnToolbarPropertyChanged; } _fontManager = context.Shell.RequireFontManager(); }
private ImageCache(int maxCacheSize, IMiniLogger logger) { _logger = logger; _cache = new NSCache(); _imageInformations = new ConcurrentDictionary<string, ImageInformation>(); _cache.TotalCostLimit = (nuint)(NSProcessInfo.ProcessInfo.PhysicalMemory * 0.2); // 20% of physical memory decimal sizeInMB = System.Math.Round((decimal)_cache.TotalCostLimit/(1024*1024), 2); logger.Debug(string.Format("LruCache size: {0}MB", sizeInMB)); // if we get a memory warning notification we should clear the cache NSNotificationCenter.DefaultCenter.AddObserver(new NSString("UIApplicationDidReceiveMemoryWarningNotification"), notif => Clear()); }
private ImageCache(int maxCacheSize) { _cache = new NSCache(); _cache.TotalCostLimit = (nuint)(NSProcessInfo.ProcessInfo.PhysicalMemory * 0.2); // 20% of physical memory // Can't use minilogger here, we would have too many dependencies decimal sizeInMB = System.Math.Round((decimal)_cache.TotalCostLimit / (1024 * 1024), 2); System.Diagnostics.Debug.WriteLine(string.Format("LruCache size: {0}MB", sizeInMB)); // if we get a memory warning notification we should clear the cache NSNotificationCenter.DefaultCenter.AddObserver(new NSString("UIApplicationDidReceiveMemoryWarningNotification"), notif => Clear()); }
private ImageCache(int maxCacheSize, IMiniLogger logger) { _cache = new NSCache(); _imageInformations = new ConcurrentDictionary <string, ImageInformation>(); _cache.TotalCostLimit = (nuint)(NSProcessInfo.ProcessInfo.PhysicalMemory * 0.2); // 20% of physical memory decimal sizeInMB = System.Math.Round((decimal)_cache.TotalCostLimit / (1024 * 1024), 2); logger.Debug(string.Format("LruCache size: {0}MB", sizeInMB)); // if we get a memory warning notification we should clear the cache NSNotificationCenter.DefaultCenter.AddObserver(new NSString("UIApplicationDidReceiveMemoryWarningNotification"), notif => Clear()); }
public static UIImage GetImage(Image image) { if (ImageCache == null) ImageCache = new NSCache (); NSObject key = NSObject.FromObject (image.Name); UIImage img = ImageCache.ObjectForKey (key) as UIImage; if (img == null) { if (NSFileManager.DefaultManager.FileExists (image.ImagePath)) { img = UIImage.FromBundle (image.ImagePath); ImageCache.SetObjectforKey (img, key); } else Console.WriteLine("Couldn't find image for {0}", image.ImagePath); } return img; }
ImageCache(int maxCacheSize, IMiniLogger logger) { _logger = logger; _cache = new NSCache(); _imageInformations = new ConcurrentDictionary <string, ImageInformation>(); if (maxCacheSize <= 0) { _cache.TotalCostLimit = (nuint)(NSProcessInfo.ProcessInfo.PhysicalMemory * 0.2d); // 20% of physical memory } else { _cache.TotalCostLimit = (nuint)Math.Min((NSProcessInfo.ProcessInfo.PhysicalMemory * 0.05d), maxCacheSize); } double sizeInMB = Math.Round(_cache.TotalCostLimit / 1024d / 1024d, 2); logger.Debug(string.Format("Image memory cache size: {0} MB", sizeInMB)); // if we get a memory warning notification we should clear the cache NSNotificationCenter.DefaultCenter.AddObserver(new NSString("UIApplicationDidReceiveMemoryWarningNotification"), notif => Clear()); }
public ShellPageRendererTracker(IShellContext context) { _context = context; _nSCache = new NSCache(); }
public TCAsyncImage () { cacheImages = new NSCache (); }
//static string storeid = "2"; static BlobWrapper() { wineBottles = new NSCache(); profilePics = new NSCache(); }
public ClusterIconGeneratorHandler(ClusterOptions options) { iconCache = new NSCache(); this.options = options; }
public CustomTileOverlay(string urlTemplate) : base(urlTemplate) { _cache = new NSCache(); _cache.RemoveAllObjects(); }
public GMUClusterIconGeneratorHandler(ClusterOptions options) { this._iconCache = new NSCache(); this._options = options; }