loadRecentInteractionData

abstract suspend fun loadRecentInteractionData(userId: String, limit: Int = 100): List<InteractionDataEntity>(source)

Retrieves the most recent interaction data for a user with configurable pagination.

This method provides efficient access to recent user interactions, ordered by timestamp in descending order. The limit parameter enables pagination support for large interaction histories while maintaining optimal query performance through database indexing.

Query Performance:

  • Composite index on (userId, timestamp) ensures efficient sorting and filtering

  • Configurable limit prevents memory overflow with large datasets

  • Descending timestamp order provides newest-first result ordering

Use Cases:

  • Real-time interaction analysis for immediate behavioral insights

  • Recent pattern detection for adaptive model updates

  • User interface display of interaction history

  • Performance monitoring and system diagnostics

Data Freshness:

  • Timestamp-based ordering ensures chronological accuracy

  • Configurable limit balances data completeness with performance

  • Consistent ordering supports reliable pagination patterns

Return

List of interaction entities ordered by timestamp (newest first)

Parameters

userId

Unique identifier for the user whose interactions should be retrieved

limit

Maximum number of interaction records to return (default: 100)

See also

Structure of returned interaction data

Method for retrieving complete interaction history

Throws

SQLException

If database query execution fails

IllegalArgumentException

If limit parameter is negative or zero