DropBear.Codex.StateManagement 2024.4.6

There is a newer version of this package available.
See the version list below for details.
dotnet add package DropBear.Codex.StateManagement --version 2024.4.6
NuGet\Install-Package DropBear.Codex.StateManagement -Version 2024.4.6
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="DropBear.Codex.StateManagement" Version="2024.4.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DropBear.Codex.StateManagement --version 2024.4.6
#r "nuget: DropBear.Codex.StateManagement, 2024.4.6"
#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 DropBear.Codex.StateManagement as a Cake Addin
#addin nuget:?package=DropBear.Codex.StateManagement&version=2024.4.6

// Install DropBear.Codex.StateManagement as a Cake Tool
#tool nuget:?package=DropBear.Codex.StateManagement&version=2024.4.6

DropBear.Codex.StateManagement

DropBear.Codex.StateManagement is a simple state management library designed to monitor and manage the state of your models efficiently. This library provides functionalities for snapshotting model states, tracking changes, and efficiently managing model state through a caching system with a sliding expiration policy.

Features

  • Snapshot Initialization: Initialize monitoring of a model by taking a snapshot of its state, which is stored in the cache with customizable expiration.
  • Change Detection: Check if the model has changed since the last snapshot was taken and obtain a list of changed properties.
  • Snapshot Management: Clear snapshots from the cache to free up resources, especially for models that are no longer in use.
  • Extension Methods: Includes extension methods to simplify checking and adding properties to models within the cache.

Getting Started

To use DropBear.Codex.StateManagement in your project, follow these steps:

  1. Add a reference to the library in your project file.

  2. Import the necessary namespaces:

    using DropBear.Codex.StateManagement.Extensions;
    using DropBear.Codex.StateManagement.Interfaces;
    
  3. Initialize a snapshot of your model:

    var model = new YourModel();
    IModelStateSnapshot snapshotManager = new ModelStateSnapshot();
    snapshotManager.InitializeSnapshot(model, TimeSpan.FromMinutes(30));
    
  4. Check for changes in the model:

    if (snapshotManager.HasModelChanged(model, out var changes)) {
    Console.WriteLine("Changes detected in the following properties:");
    foreach (var change in changes) {
    Console.WriteLine(change);}}
    
  5. Clear snapshots from the cache:

       snapshotManager.ClearSnapshot(model);
    

License

This project is licensed under the LGPLv3 License - see the https://www.gnu.org/licenses/lgpl-3.0.en.html for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2024.5.9 77 5/14/2024
2024.5.8 93 5/14/2024
2024.5.7 93 5/4/2024
2024.5.6 91 5/4/2024
2024.5.4 90 5/4/2024
2024.5.3 104 5/4/2024
2024.5.2 45 5/3/2024
2024.5.1 45 5/3/2024
2024.4.44 41 5/3/2024
2024.4.41 49 5/3/2024
2024.4.37 44 5/3/2024
2024.4.36 44 5/3/2024
2024.4.34 71 5/1/2024
2024.4.32 80 4/30/2024
2024.4.31 75 4/30/2024
2024.4.30 80 4/30/2024
2024.4.29 81 4/30/2024
2024.4.27 81 4/30/2024
2024.4.25 83 4/30/2024
2024.4.24 81 4/30/2024
2024.4.23 79 4/30/2024
2024.4.22 84 4/30/2024
2024.4.21 76 4/30/2024
2024.4.20 80 4/30/2024
2024.4.19 86 4/30/2024
2024.4.16 71 4/29/2024
2024.4.14 70 4/29/2024
2024.4.13 72 4/28/2024
2024.4.12 71 4/28/2024
2024.4.10 73 4/28/2024
2024.4.7 83 4/26/2024
2024.4.6 83 4/25/2024
2024.4.5 84 4/19/2024
2024.4.3 84 4/19/2024
2024.4.2 92 4/16/2024
2024.3.6 162 3/29/2024
2024.3.5 87 3/21/2024
2024.3.4 98 3/17/2024
2024.3.3 105 3/17/2024