StarryEyes.Models.Timelines.Statuses.StatusModel.CollectGarbages C# (CSharp) Method

CollectGarbages() public static method

public static CollectGarbages ( ) : void
return void
        public static void CollectGarbages()
        {
            var values = _staticCache.Keys.ToArray();
            foreach (var ids in values.Buffer(256))
            {
                foreach (var id in ids)
                {
                    WeakReference<StatusModel> wr;
                    StatusModel target;
                    if (_staticCache.TryGetValue(id, out wr) && !wr.TryGetTarget(out target))
                    {
                        _staticCache.TryRemove(id, out wr);
                    }
                }
                Thread.Sleep(0);
            }
        }