ToolBX.Collections.Caching 2.2.0

dotnet add package ToolBX.Collections.Caching --version 2.2.0
NuGet\Install-Package ToolBX.Collections.Caching -Version 2.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ToolBX.Collections.Caching" Version="2.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ToolBX.Collections.Caching --version 2.2.0
#r "nuget: ToolBX.Collections.Caching, 2.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ToolBX.Collections.Caching as a Cake Addin
#addin nuget:?package=ToolBX.Collections.Caching&version=2.2.0

// Install ToolBX.Collections.Caching as a Cake Tool
#tool nuget:?package=ToolBX.Collections.Caching&version=2.2.0

Caching

Caching collections

Collections that are limited to a specified size in order to be used as object caches.

Observability

All collections in this package implement the IObservableCollection<T> interface from ToolBX.Collections.Common.

var collection = new CachingDictionary<int, string>();
collections.CollectionChanged += DictionaryChanged;

Limit property

Limits the number of items allowed in the collection to this number. The oldest elements are removed first. If you wanted to limit your list to the 10 last elements, you would do this :

var collection = new CachingList<string>();
collection.Limit = 10;

This way, adding an eleventh element will remove the oldest so that your list always has a maximum of 10 elements.

TrimStartDownTo

Removes the x oldest elements that were added to the collection.

//Removes the five oldest elements in the collection
collection.TrimStartDownTo(5);

TrimEndDownTo

Removes the x newest elements that were added to the collection.

//Removes the eight newest elements in the collection
collection.TrimStartDownTo(8);
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ToolBX.Collections.Caching:

Package Downloads
ToolBX.Collections.UnitTesting

Tester classes and extensions to help with unit testing ToolBX.Collections.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.2.0 120 1/13/2024
2.2.0-beta2 69 1/7/2024
2.2.0-beta1 65 1/4/2024
2.0.0 388 11/11/2022
2.0.0-beta2 155 10/3/2022
2.0.0-beta1 170 9/22/2022
1.0.1 427 7/15/2022
1.0.0 423 7/11/2022