Skip to content

Commit

Permalink
feat: v0.16 doc (#2)
Browse files Browse the repository at this point in the history
* feat: v0.16 doc

* fix: deploy ci (#3)

* fix: merge release17

* fix: bug

* feat: cache

* fix: bug

* chore: update title and datetime

* Update release-v0.16.md

* Update release-v0.16.md

---------

Co-authored-by: chenos <[email protected]>
Co-authored-by: xilesun <[email protected]>
  • Loading branch information
3 people authored Nov 20, 2023
1 parent 0fd1979 commit 2dec77e
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 8 deletions.
14 changes: 7 additions & 7 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ export default defineConfig({
],
markdown: {
remarkPlugins: [
remarkToc,
[
remarkCollapse,
{
test: "Table of contents",
},
],
[remarkToc, { heading: "Table of contents" }],
// [
// remarkCollapse,
// {
// // test: "Table of contents",
// },
// ],
],
shikiConfig: {
theme: "one-dark-pro",
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

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

59 changes: 59 additions & 0 deletions src/content/blog/release-v0.16.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
author: Lin Chen
pubDatetime: 2023-11-20T19:59:00Z
title: "NocoBase 0.16: New cache manager"
postSlug: release-v0.16
# featured: true
draft: false
tags:
- release
ogImage: ""
description: ""
---

## New Features

The previous version of cache has poor usability (only support memory cache), v0.16 has been refactored, built-in memory and redis store, it also supports custom store. please refer to the [API documentation](https://docs.nocobase.com/api/cache/cache-manager) for the details of how to use.

## Breaking Changes

### Cache creation method update

Deprecated: Use `createCache` for cache creation.

```ts
import { createCache } from "@nocobase/cache";

const cache = createCache();
```

Cache now managed by `CacheManager` and created with `app.cacheManager`.

```ts
const cache = await app.cacheManager.createCache({
name: "memory", // unique name of cache
store: "memory", // unique name of cache method
// other config
max: 2000,
ttl: 60 * 1000,
});
```

### Environment variables update

Previous environment variables of cache required a JSON string for configuring.

```bash
CACHE_CONFIG={"storePackage":"cache-manager-fs-hash","ttl":86400,"max":1000}
```

New environment variables for configuring cache:

```bash
# Unique name of default cache method, memory or redis
CACHE_DEFAULT_STORE=memory
# Max number of items in memory cache
CACHE_MEMORY_MAX=2000
# Redis,optional
CACHE_REDIS_URL=redis://localhost:6379
```

0 comments on commit 2dec77e

Please sign in to comment.