Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
HashStoreModule.cs
1using System;
2using System.Threading;
3using System.Threading.Tasks;
4using Waher.Events;
9
11{
15 [Singleton]
16 public class HashStoreModule : IModule
17 {
18 private static bool running = false;
19 private static Timer timer = null;
20
24 public static bool Running => running;
25
29 public Task Start()
30 {
31 int OneHour = 1000 * 60 * 60;
32
33 running = true;
34 timer = new Timer(DeleteExpiredHashes, null, OneHour, OneHour);
35
36 return Task.CompletedTask;
37 }
38
42 public Task Stop()
43 {
44 running = false;
45
46 timer?.Dispose();
47 timer = null;
48
49 return Task.CompletedTask;
50 }
51
52 private static async void DeleteExpiredHashes(object _)
53 {
54 try
55 {
57 new FilterFieldLesserOrEqualTo("ExpiresUtc", DateTime.UtcNow));
58 }
59 catch (Exception ex)
60 {
61 Log.Exception(ex);
62 }
63 }
64 }
65}
Static class managing the application event log. Applications and services log events on this static ...
Definition: Log.cs:14
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Definition: Log.cs:1657
Static interface for database persistence. In order to work, a database provider has to be assigned t...
Definition: Database.cs:21
static async Task Delete(object Object)
Deletes an object in the database.
Definition: Database.cs:1291
This filter selects objects that have a named field lesser or equal to a given value.
Contains information about a persisted hash
Module controling the life-cycle of persisted hash values.
static bool Running
If the module is running or not.
Interface for late-bound modules loaded at runtime.
Definition: IModule.cs:9
Definition: ImplTypes.g.cs:58