Skip to content

Commit

Permalink
fix(sandbox): fix cache sandbox (#2232)
Browse files Browse the repository at this point in the history
gh-00
  • Loading branch information
yeshamavani authored Jan 7, 2025
1 parent 70bcdff commit 3546826
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions sandbox/cache-example/src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
RestExplorerComponent,
} from '@loopback/rest-explorer';
import {ServiceMixin} from '@loopback/service-proxy';
import {CachePluginComponent} from '@sourceloop/cache';
import {CachingComponent} from '@sourceloop/cache';
import path from 'path';
import {MySequence} from './sequence';

Expand All @@ -35,7 +35,7 @@ export class CacheExampleApplication extends BootMixin(
});
this.component(RestExplorerComponent);

this.component(CachePluginComponent);
this.component(CachingComponent);

this.projectRoot = __dirname;
// Customize @loopback/boot Booter Conventions here
Expand Down
9 changes: 3 additions & 6 deletions sandbox/cache-example/src/repositories/product.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@
// https://opensource.org/licenses/MIT
import {Constructor, Getter, inject} from '@loopback/core';
import {DefaultCrudRepository} from '@loopback/repository';
import {CacheManager} from '@sourceloop/cache';
import {CacheMixin} from '@sourceloop/cache';
import {CacheDbDataSource, DbDataSource} from '../datasources';
import {Product} from '../models';

export class ProductRepository extends CacheManager.CacheRepositoryMixin<
export class ProductRepository extends CacheMixin<
Product,
typeof Product.prototype.id,
{},
Constructor<DefaultCrudRepository<Product, typeof Product.prototype.id, {}>>
>(DefaultCrudRepository, {
prefix: 'product',
ttl: 50000,
}) {
>(DefaultCrudRepository) {
redisDataSource: CacheDbDataSource;
constructor(
@inject('datasources.db') readonly dataSource: DbDataSource,
Expand Down

0 comments on commit 3546826

Please sign in to comment.