Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/perrich/Hangfire.MemoryStorage
A memory storage for Hangfire.
https://github.com/perrich/Hangfire.MemoryStorage
hangfire memory-storage
Last synced: about 2 months ago
JSON representation
A memory storage for Hangfire.
- Host: GitHub
- URL: https://github.com/perrich/Hangfire.MemoryStorage
- Owner: perrich
- License: apache-2.0
- Created: 2015-05-17T07:16:10.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-05-08T16:10:42.000Z (5 months ago)
- Last Synced: 2024-07-16T06:10:50.290Z (2 months ago)
- Topics: hangfire, memory-storage
- Language: C#
- Homepage:
- Size: 102 KB
- Stars: 130
- Watchers: 7
- Forks: 43
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Hangfire.MemoryStorage
========A memory storage for Hangfire (http://hangfire.io).
It can be useful for testing purpose like check the behaviour and use it in a development environment.
Please note that :
* it should not be used in production (no integrity and no thread safe even if many cases are managed).
* data are stored in memory using a dictionary in a static way (See Data created at the storage creation)
* Hangfire has its own solution (see https://github.com/HangfireIO/Hangfire.InMemory)How To use MemoryStorage
---GlobalConfiguration.Configuration.UseMemoryStorage();
Example: Set a job now and execute.
#### Startup Class ####
```csharp
public void ConfigureServices(IServiceCollection services)
{ // Add This
services.AddHangfire(config =>
{
config.UseMemoryStorage();
});
}public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
// Add This
app.UseHangfireDashboard();
app.UseHangfireServer();
}```
```csharp
static void Main(string[] args)
{
BackgroundJob.Enqueue(() => System.IO.File.WriteAllText(@"..\test.txt","1"));
}
```#### OutPut: ####
test.txt
1License:
---
Copyright 2015 - 2023 PERRICHOT FlorianLicensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.