Skip to main content
Skip table of contents

MongoService

Name

MongoService

Class Path

be.securit.trustbuilder.service.MongoService

Versions

11

Overview

The MongoService interface defines methods for interacting with a MongoDB instance with TTL (Time-To-Live) support. It provides basic operations to store and retrieve values with an expiration mechanism.


Available Methods

void mongoTTLWrite(String key, String value, int ttl)

Stores a key-value pair in MongoDB with a specified TTL (Time-To-Live).

  • Parameters:

    • key (String): The unique identifier for the value.

    • value (String): The data to be stored.

    • ttl (int): The time (in seconds) before the entry expires.


String mongoTTLRead(String key)

Retrieves a stored value based on the given key.

  • Parameters:

    • key (String): The unique identifier of the stored value.

  • Returns:

    • String: The retrieved value or null if the key does not exist or has expired.


Summary

The MongoService interface provides an abstraction for managing temporary data in MongoDB using TTL. It allows:

  • Writing key-value pairs with an expiration time.

  • Retrieving values before they expire.

This is particularly useful for session management, caching, and temporary storage scenarios in applications that require MongoDB persistence.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.