Skip to content

Need clarification/documention about JobStorageTransaction (AddRangeToSet, AddToSet, InsertToList, IncrementCounter) #2543

Description

@robin-83

Hi,

I would like to know, if I can use e.g. JobStorageTransaction.AddToSet to persist custom data in the Hangfire database. If so, is there a best practice how to name the keys, so that name conflicts are avoided?

My use case: I am using Hangfire to automate a third party application, which needs to be restarted after a certain amount of times the app has been automated by my Hangfire job (not a Timespan). So I have to keep track of the usage for this machine only (multiple Servers exist).

I am planning to use IncrementCount (only if I can reset or delete it) or a simple key value entry:
Key="custom:ThirdPartyAppUsageCount{machinename}", value=counter

May I use the built-in Hangfire tables for this or do I need to persist this in an additional data source?

Robin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions