Merge branch 'master' into patch-3
Signed-off-by: JeevaRamanathan <64531160+JeevaRamanathan@users.noreply.github.com>
This commit is contained in:
@@ -7,6 +7,39 @@ description: Documentation for the Cache service
|
||||
|
||||
This service lets your plugin interact with a cache. It is bound to your plugin too, so that you will only set and get values in your plugin's private namespace.
|
||||
|
||||
## Configuration
|
||||
|
||||
The cache service can be configured using the `backend.cache` section in your `app-config.yaml`:
|
||||
|
||||
```yaml
|
||||
backend:
|
||||
cache:
|
||||
store: redis # or 'valkey', 'memcache', 'memory'
|
||||
connection: redis://localhost:6379
|
||||
|
||||
# Store-specific configuration (Redis/Valkey only)
|
||||
redis:
|
||||
client:
|
||||
# Optional: Global namespace prefix for all cache keys
|
||||
namespace: 'my-app'
|
||||
# Optional: Separator used between namespace and plugin ID (default: ':')
|
||||
keyPrefixSeparator: ':'
|
||||
# Other Redis-specific options...
|
||||
clearBatchSize: 1000
|
||||
useUnlink: false
|
||||
```
|
||||
|
||||
### Namespace Configuration
|
||||
|
||||
For Redis and Valkey stores, you can configure a global namespace that will be prefixed to all cache keys:
|
||||
|
||||
- **Without namespace**: Cache keys use only the plugin ID (e.g., `catalog:some-key`)
|
||||
- **With namespace**: Cache keys use the format `namespace:pluginId:key` (e.g., `my-app:catalog:some-key`)
|
||||
|
||||
The `keyPrefixSeparator` controls what character is used between the namespace and plugin ID (defaults to `:`).
|
||||
|
||||
**Note**: Memory and Memcache stores do not support namespace configuration and will always use the plugin ID directly.
|
||||
|
||||
## Using the service
|
||||
|
||||
The following example shows how to get a cache client in your `example` backend plugin and setting and getting values from the cache.
|
||||
|
||||
+18
-4
@@ -16,10 +16,24 @@ allowing for customization.
|
||||
## Supplying Configuration
|
||||
|
||||
Configuration is stored in YAML files where the defaults are `app-config.yaml`
|
||||
and `app-config.local.yaml` for local overrides. Other sets of files can by
|
||||
loaded by passing `--config <path>` flags. The configuration files themselves
|
||||
contain plain YAML, but with support for loading in data and secrets from
|
||||
various sources using for example `$env` and `$file` keys.
|
||||
and `app-config.local.yaml` for local overrides. Additionally, it is possible
|
||||
to define environment based configuration files with `BACKSTAGE_ENV`
|
||||
environment variable, which will load `app-config.<BACKSTAGE_ENV>.yaml`.
|
||||
|
||||
Loading order of these files is as follows:
|
||||
|
||||
1. `app-config.yaml`
|
||||
2. `app-config.<BACKSTAGE_ENV>.yaml`
|
||||
3. `app-config.local.yaml`
|
||||
4. `app-config.<BACKSTAGE_ENV>.local.yaml`
|
||||
|
||||
Other sets of files can by loaded by passing `--config <path>` flags.
|
||||
Read more about the configuration loading order in the
|
||||
[Configuration Files](./writing.md#configuration-files) section.
|
||||
|
||||
The configuration files themselves contain plain YAML, but with support for
|
||||
loading in data and secrets from various sources using for example
|
||||
`$env` and `$file` keys.
|
||||
|
||||
It is also possible to supply configuration through environment variables, for
|
||||
example `APP_CONFIG_app_baseUrl=https://staging.example.com`. However these
|
||||
|
||||
@@ -221,7 +221,3 @@ future.
|
||||
|
||||
- [`catalog-info.yaml`](https://github.com/backstage/backstage/tree/master/catalog-info.yaml) -
|
||||
Description of Backstage in the Backstage Entity format.
|
||||
|
||||
- [`lerna.json`](https://github.com/backstage/backstage/tree/master/lerna.json) -
|
||||
[Lerna](https://github.com/lerna/lerna) monorepo config. We are using
|
||||
`yarn workspaces`, so this will only be used for executing scripts.
|
||||
|
||||
@@ -89,8 +89,8 @@ app
|
||||
- **package.json**: Root package.json for the project. _Note: Be sure that you
|
||||
don't add any npm dependencies here as they probably should be installed in
|
||||
the intended workspace rather than in the root._
|
||||
- **packages/**: Lerna leaf packages or "workspaces". Everything here is going
|
||||
to be a separate package managed by Lerna.
|
||||
- **packages/**: Yarn workspaces, everything here is going
|
||||
to be a separate package, managed by Yarn.
|
||||
- **packages/app/**: A fully functioning Backstage frontend app that acts as a
|
||||
good starting point for you to get to know Backstage.
|
||||
- **packages/backend/**: We include a backend that helps power features such as
|
||||
|
||||
@@ -208,7 +208,7 @@ One of the [packages](#package) within a [monorepo](#monorepo). A package may or
|
||||
|
||||
1. A single repository for a collection of related software projects, such as all projects belonging to an organization.
|
||||
|
||||
2. A project layout that consists of multiple [packages](#package) within a single project, where packages are able to have local dependencies on each other. Often enabled through tooling such as [lerna](https://lerna.js.org/) and [yarn workspaces](https://classic.yarnpkg.com/en/docs/workspaces/)
|
||||
2. A project layout that consists of multiple [packages](#package) within a single project, where packages are able to have local dependencies on each other. Often enabled through tooling such as [yarn workspaces](https://classic.yarnpkg.com/en/docs/workspaces/)
|
||||
|
||||
## Name
|
||||
|
||||
|
||||
Reference in New Issue
Block a user