70 lines
1.7 KiB
Markdown
70 lines
1.7 KiB
Markdown
# Getting Started
|
|
|
|
## Storage
|
|
Hangfire 會將所有相關資訊會被序列化後保存到儲存區,如類型、方法或參數等。
|
|
|
|
儲存模型官方預設有以下幾種
|
|
|
|
<table>
|
|
<thead>
|
|
<td></td>
|
|
<td>Sql Server 2008+</td>
|
|
<td>Redis 2.6.12+</td>
|
|
<td>In-Memory</td>
|
|
<td>Price</td>
|
|
</thead>
|
|
<tbody>
|
|
<td>Open</td>
|
|
<td>✔</td>
|
|
<td></td>
|
|
<td>✔</td>
|
|
<td>free</td>
|
|
</tbody>
|
|
<tbody>
|
|
<td>Startup</td>
|
|
<td>✔</td>
|
|
<td>✔</td>
|
|
<td>✔</td>
|
|
<td>$500 / per year</td>
|
|
</tbody>
|
|
<tbody>
|
|
<td>Business</td>
|
|
<td>✔</td>
|
|
<td>✔</td>
|
|
<td>✔</td>
|
|
<td>$1,500 / per year</td>
|
|
</tbody>
|
|
<tbody>
|
|
<td>Enterprise</td>
|
|
<td>✔</td>
|
|
<td>✔</td>
|
|
<td>✔</td>
|
|
<td>$4,500 / per year</td>
|
|
</tbody>
|
|
</table>
|
|
|
|
資料來源日期: 2024/03/12
|
|
|
|
```
|
|
// Version 1.8
|
|
GlobalConfiguration
|
|
.Configuration
|
|
.SetDataCompatibilityLevel(CompatibilityLevel.Version_180)
|
|
.UseSimpleAssemblyNameTypeSerializer()
|
|
.UseRecommendedSerializerSettings()
|
|
.UseSqlServerStorage("Database=Hangfire.Sample; Integrated Security=True;");
|
|
|
|
// Version 1.7
|
|
GlobalConfiguration
|
|
.Configuration
|
|
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
|
|
.UseSimpleAssemblyNameTypeSerializer()
|
|
.UseRecommendedSerializerSettings()
|
|
.UseSqlServerStorage("Database=Hangfire.Sample; Integrated Security=True;", new SqlServerStorageOptions
|
|
{
|
|
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
|
|
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
|
|
QueuePollInterval = TimeSpan.Zero,
|
|
UseRecommendedIsolationLevel = true
|
|
});
|
|
``` |