![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@sourceloop/cache
Advanced tools
A Caching component that provides helpers for caching in Loopback4 based microservices.
Install CachingComponent using npm
;
$ [npm install | yarn add] @sourceloop/cache
Configure and load CachingComponent in the application constructor as shown below.
import {CachingComponent} from '@sourceloop/cache';
// ...
export class MyApplication extends BootMixin(
ServiceMixin(RepositoryMixin(RestApplication)),
) {
constructor(options: ApplicationConfig = {}) {
this.bind(CacheComponentBindings.CacheConfig).to({
ttl: 1000,
strategy: RedisStoreStrategy,
datasourceName: 'redisCacheStore',
});
this.component(CachingComponent);
// ...
}
// ...
}
To add caching to a repository, just add it as a mixin to the base class -
export class TestWithMixinRepository extends CacheMixin(
DefaultCrudRepository<Test, number, {}>,
) {
cacheIdentifier = 'testRepo';
constructor(@inject('datasources.memorydb') dataSource: juggler.DataSource) {
super(Test, dataSource);
}
}
To add caching to a service or controller, just implement the ICachedService
interface, adding a binding for the ICacheService
and the applying the relevant decorators to the methods you want cached -
export class TestController implements ICachedService {
constructor(
@repository(TestWithoutCachingRepository)
public testModelRepository: TestWithoutCachingRepository,
@inject(CacheComponentBindings.CacheService)
public cache: ICacheService,
) {}
cacheIdentifier = 'testRepo';
@cacheInvalidator()
@post('/tests')
@response(200, {
description: 'Test model instance',
content: {'application/json': {schema: getModelSchemaRef(Test)}},
})
async create(
@requestBody({
content: {
'application/json': {
schema: getModelSchemaRef(Test, {
title: 'NewTest',
exclude: ['id'],
}),
},
},
})
testModel: Omit<Test, 'id'>,
): Promise<Test> {
return this.testModelRepository.create(testModel);
}
// ...
@cachedItem()
@get('/tests/count')
@response(200, {
description: 'Test model count',
content: {'application/json': {schema: CountSchema}},
})
async count(@param.where(Test) where?: Where<Test>): Promise<Count> {
return this.testModelRepository.count(where);
}
/// ...
FAQs
A caching extension to cache methods.
The npm package @sourceloop/cache receives a total of 48 weekly downloads. As such, @sourceloop/cache popularity was classified as not popular.
We found that @sourceloop/cache demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.