Class: MemoryStorage
Defined in: core/storage/memory.storage.ts:25
In-memory storage implementation for NestLens. Zero dependencies, works everywhere including Docker. Ideal for testing, development, and containerized environments.
Implements
StorageInterfaceOnModuleDestroy
Constructors
Constructor
new MemoryStorage(
config):MemoryStorage
Defined in: core/storage/memory.storage.ts:45
Parameters
config
MemoryStorageConfig = {}
Returns
MemoryStorage
Methods
addMonitoredTag()
addMonitoredTag(
rawTag):Promise<MonitoredTag>
Defined in: core/storage/memory.storage.ts:500
Add a monitored tag
Parameters
rawTag
string
Returns
Promise<MonitoredTag>
Implementation of
StorageInterface.addMonitoredTag
addTags()
addTags(
entryId,tags):Promise<void>
Defined in: core/storage/memory.storage.ts:401
Add tags to an entry
Parameters
entryId
number
tags
string[]
Returns
Promise<void>
Implementation of
clear()
clear(
type?):Promise<number>
Defined in: core/storage/memory.storage.ts:230
Delete entries — all of them, or all of one type.
Different from pruning in two ways, both deliberate: age is not consulted, and an entry carrying a monitored tag goes with the rest. Monitoring says do not let pruning take these; somebody pressing a button that says delete has said something else.
Returns how many were deleted, because a reader who pressed it deserves to be told what happened.
Parameters
type?
"query" | "request" | "exception" | "log" | "cache" | "event" | "job" | "schedule" | "mail" | "http-client" | "redis" | "model" | "notification" | "view" | "command" | "gate" | "batch" | "dump" | "graphql"
Returns
Promise<number>
Implementation of
close()
close():
Promise<void>
Defined in: core/storage/memory.storage.ts:259
Close the storage connection
Returns
Promise<void>
Implementation of
count()
count(
type?):Promise<number>
Defined in: core/storage/memory.storage.ts:213
Get entries count by type
Parameters
type?
"query" | "request" | "exception" | "log" | "cache" | "event" | "job" | "schedule" | "mail" | "http-client" | "redis" | "model" | "notification" | "view" | "command" | "gate" | "batch" | "dump" | "graphql"
Returns
Promise<number>
Implementation of
find()
find(
filter):Promise<Entry[]>
Defined in: core/storage/memory.storage.ts:84
Find entries by filter
Parameters
filter
Returns
Promise<Entry[]>
Implementation of
findByFamilyHash()
findByFamilyHash(
familyHash,limit):Promise<Entry[]>
Defined in: core/storage/memory.storage.ts:550
Find entries by family hash
Parameters
familyHash
string
limit
number = 50
Returns
Promise<Entry[]>
Implementation of
StorageInterface.findByFamilyHash
findById()
findById(
id):Promise<Entry|null>
Defined in: core/storage/memory.storage.ts:205
Find a single entry by ID
Parameters
id
number
Returns
Promise<Entry | null>
Implementation of
findByTags()
findByTags(
tags,logic,limit):Promise<Entry[]>
Defined in: core/storage/memory.storage.ts:459
Find entries by tags
Parameters
tags
string[]
logic
"AND" | "OR"
limit
number = 50
Returns
Promise<Entry[]>
Implementation of
findWithCursor()
findWithCursor(
type,params):Promise<CursorPaginatedResponse<Entry>>
Defined in: core/storage/memory.storage.ts:134
Find entries with cursor-based pagination
Parameters
type
"query" | "request" | "exception" | "log" | "cache" | "event" | "job" | "schedule" | "mail" | "http-client" | "redis" | "model" | "notification" | "view" | "command" | "gate" | "batch" | "dump" | "graphql" | undefined
params
Returns
Promise<CursorPaginatedResponse<Entry>>
Implementation of
StorageInterface.findWithCursor
getAllTags()
getAllTags():
Promise<TagWithCount[]>
Defined in: core/storage/memory.storage.ts:447
Get all tags with their counts
Returns
Promise<TagWithCount[]>
Implementation of
getEntryTags()
getEntryTags(
entryId):Promise<string[]>
Defined in: core/storage/memory.storage.ts:442
Get tags for an entry
Parameters
entryId
number
Returns
Promise<string[]>
Implementation of
getGroupedByFamilyHash()
getGroupedByFamilyHash(
type?,limit?):Promise<object[]>
Defined in: core/storage/memory.storage.ts:559
Get grouped entries by family hash
Parameters
type?
"query" | "request" | "exception" | "log" | "cache" | "event" | "job" | "schedule" | "mail" | "http-client" | "redis" | "model" | "notification" | "view" | "command" | "gate" | "batch" | "dump" | "graphql"
limit?
number = 50
Returns
Promise<object[]>
Implementation of
StorageInterface.getGroupedByFamilyHash
getLatestSequence()
getLatestSequence(
type?):Promise<number|null>
Defined in: core/storage/memory.storage.ts:265
Get the latest entry sequence (ID)
Parameters
type?
"query" | "request" | "exception" | "log" | "cache" | "event" | "job" | "schedule" | "mail" | "http-client" | "redis" | "model" | "notification" | "view" | "command" | "gate" | "batch" | "dump" | "graphql"
Returns
Promise<number | null>
Implementation of
StorageInterface.getLatestSequence
getMonitoredTags()
getMonitoredTags():
Promise<MonitoredTag[]>
Defined in: core/storage/memory.storage.ts:521
Get all monitored tags
Returns
Promise<MonitoredTag[]>
Implementation of
StorageInterface.getMonitoredTags
getStats()
getStats():
Promise<EntryStats>
Defined in: core/storage/memory.storage.ts:277
Get statistics
Returns
Promise<EntryStats>
Implementation of
getStorageStats()
getStorageStats():
Promise<StorageStats>
Defined in: core/storage/memory.storage.ts:314
Get storage statistics including size info
Returns
Promise<StorageStats>
Implementation of
StorageInterface.getStorageStats
hasEntriesAfter()
hasEntriesAfter(
sequence,type?):Promise<number>
Defined in: core/storage/memory.storage.ts:271
Check if there are entries after a given sequence
Parameters
sequence
number
type?
"query" | "request" | "exception" | "log" | "cache" | "event" | "job" | "schedule" | "mail" | "http-client" | "redis" | "model" | "notification" | "view" | "command" | "gate" | "batch" | "dump" | "graphql"
Returns
Promise<number>
Implementation of
StorageInterface.hasEntriesAfter
initialize()
initialize():
Promise<void>
Defined in: core/storage/memory.storage.ts:49
Initialize the storage (create tables, etc.)
Returns
Promise<void>
Implementation of
onModuleDestroy()
onModuleDestroy():
void
Defined in: core/storage/memory.storage.ts:593
Returns
void
Implementation of
OnModuleDestroy.onModuleDestroy
prune()
prune(
before):Promise<number>
Defined in: core/storage/memory.storage.ts:359
Delete entries older than given date
Parameters
before
Date
Returns
Promise<number>
Implementation of
pruneByType()
pruneByType(
type,before):Promise<number>
Defined in: core/storage/memory.storage.ts:379
Delete entries older than given date for a specific type
Parameters
type
"query" | "request" | "exception" | "log" | "cache" | "event" | "job" | "schedule" | "mail" | "http-client" | "redis" | "model" | "notification" | "view" | "command" | "gate" | "batch" | "dump" | "graphql"
before
Date
Returns
Promise<number>
Implementation of
removeMonitoredTag()
removeMonitoredTag(
rawTag):Promise<void>
Defined in: core/storage/memory.storage.ts:517
Remove a monitored tag
Parameters
rawTag
string
Returns
Promise<void>
Implementation of
StorageInterface.removeMonitoredTag
removeTags()
removeTags(
entryId,tags):Promise<void>
Defined in: core/storage/memory.storage.ts:425
Remove tags from an entry
Parameters
entryId
number
tags
string[]
Returns
Promise<void>
Implementation of
resolveEntry()
resolveEntry(
id):Promise<void>
Defined in: core/storage/memory.storage.ts:527
Mark an entry as resolved
Parameters
id
number
Returns
Promise<void>
Implementation of
save()
save(
entry):Promise<StoredEntry>
Defined in: core/storage/memory.storage.ts:55
Save an entry to storage
Parameters
entry
Returns
Promise<StoredEntry>
Implementation of
saveBatch()
saveBatch(
entries):Promise<StoredEntry[]>
Defined in: core/storage/memory.storage.ts:73
Save multiple entries at once Returns the saved entries with IDs
Parameters
entries
Entry[]
Returns
Promise<StoredEntry[]>
Implementation of
unresolveEntry()
unresolveEntry(
id):Promise<void>
Defined in: core/storage/memory.storage.ts:534
Mark an entry as unresolved
Parameters
id
number
Returns
Promise<void>
Implementation of
StorageInterface.unresolveEntry
updateFamilyHash()
updateFamilyHash(
id,familyHash):Promise<void>
Defined in: core/storage/memory.storage.ts:543
Update family hash for an entry
Parameters
id
number
familyHash
string
Returns
Promise<void>