Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/cache",
"version": "5.0.0",
"version": "5.1.0",
"description": "The cache handler for Athenna Framework.",
"license": "MIT",
"author": "João Lenon <lenon@athenna.io>",
Expand Down
13 changes: 5 additions & 8 deletions src/cache/CacheImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class CacheImpl<Driver extends DriverImpl = any> extends Macroable {
/**
* The drivers responsible for handling cache operations.
*/
public driver: MemoryDriver = null
public driver: Driver = null

/**
* Creates a new instance of CacheImpl.
Expand All @@ -33,13 +33,13 @@ export class CacheImpl<Driver extends DriverImpl = any> extends Macroable {
this.driver = StoreFactory.fabricate(
this.storeName,
athennaCacheOpts?.options
)
) as unknown as Driver

this.connect(athennaCacheOpts)
}

public store(con: 'memory', options?: StoreOptions): CacheImpl<MemoryDriver>

public store(store: 'memory', options?: StoreOptions): CacheImpl<MemoryDriver>
public store(store: 'memory' | string): CacheImpl<MemoryDriver>
/**
* Change the store connection.
*
Expand All @@ -48,10 +48,7 @@ export class CacheImpl<Driver extends DriverImpl = any> extends Macroable {
* await Cache.store('redis').set('my:cache:key', 'hello')
* ```
*/
public store(
store: 'memory' | string,
options?: StoreOptions
): CacheImpl<Driver> {
public store(store: 'memory' | string, options?: StoreOptions) {
const driver = StoreFactory.fabricate(store, options?.options)
const cache = new CacheImpl<typeof driver>(options)

Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
export * from '#src/types'
export * from '#src/facades/Cache'
export * from '#src/cache/CacheImpl'
export * from '#src/factories/StoreFactory'
export * from '#src/providers/CacheProvider'
export * from '#src/cache/drivers/MemoryDriver'
Loading