当前位置: 首页 > 软件库 > 大数据 > 数据查询 >

apollo-cache-persist

授权协议 MIT License
开发语言 Java
所属分类 大数据、 数据查询
软件类型 开源软件
地区 不详
投 递 者 邢英奕
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

apollo3-cache-persist

Simple persistence for all Apollo Client 3.0 cache implementations, includingInMemoryCache and Hermes.

Supports web and React Native. See all storage providers.

Basic Usage

npm install --save apollo3-cache-persist

or

yarn add apollo3-cache-persist

To get started, simply pass your Apollo cache and anunderlying storage provider to persistCache.

By default, the contents of your Apollo cache will be immediately restored(asynchronously, see how to persist data before rendering), and will be persisted upon every write to the cache (with ashort debounce interval).

Examples

React Native

import AsyncStorage from '@react-native-async-storage/async-storage';
import { InMemoryCache } from '@apollo/client/core';
import { persistCache, AsyncStorageWrapper } from 'apollo3-cache-persist';

const cache = new InMemoryCache({...});

// await before instantiating ApolloClient, else queries might run before the cache is persisted
await persistCache({
  cache,
  storage: new AsyncStorageWrapper(AsyncStorage),
});

// Continue setting up Apollo as usual.

const client = new ApolloClient({
  cache,
  ...
});

See a complete example in the React Native example.

Web

import { InMemoryCache } from '@apollo/client/core';
import { persistCache, LocalStorageWrapper } from 'apollo3-cache-persist';

const cache = new InMemoryCache({...});

// await before instantiating ApolloClient, else queries might run before the cache is persisted
await persistCache({
  cache,
  storage: new LocalStorageWrapper(window.localStorage),
});

// Continue setting up Apollo as usual.

const client = new ApolloClient({
  cache,
  ...
});

See a complete example in the web example.

Contributing

Want to make the project better? Awesome! Please read through our Contributing Guidelines.

Maintainers

We all do this for free... so please be nice �� .

  • Spark cache的用法及其误区: 一、使用Cache注意下面三点 (1)cache之后一定不能立即有其它算子,不能直接去接算子。因为在实际工作的时候,cache后有算子的话,它每次都会重新触发这个计算过程。 (2)cache不是一个action,运行它的时候没有执行一个作业。 (3)cache缓存如何让它失效:unpersist,它是立即执行的。persist是lazy级别的(没有计算),u

  • 1. 什么是Namespace? Namespace是配置项的集合,类似于一个配置文件的概念。 2. 什么是“application”的Namespace? Apollo在创建项目的时候,都会默认创建一个“application”的Namespace。顾名思义,“application”是给应用自身使用的,熟悉Spring Boot的同学都知道,Spring Boot项目都有一个默认配置文件app

  • 1. 什么是Namespace? Namespace是配置项的集合,类似于一个配置文件的概念。 2. 什么是“application”的Namespace? Apollo在创建项目的时候,都会默认创建一个“application”的Namespace。顾名思义,“application”是给应用自身使用的,熟悉Spring Boot的同学都知道,Spring Boot项目都有一个默认配置文件app

  • 昨天面试被问到了cache和persist区别,当时只记得是其中一个调用了另一个,但没有回答出二者的不同,所以回来后重新看了源码,算是弄清楚它们的区别了。 cache和persist都是用于将一个RDD进行缓存的,这样在之后使用的过程中就不需要重新计算了,可以大大节省程序运行时间。 cache和persist的区别 基于Spark 1.4.1 的源码,可以看到 /** Persist this R

  • Apache Apollo是一个代理服务器,主要用于消息的请求转发,下面是其常用的一些配置文件的介绍 一、users.properties: 用来配置可以使用服务器的用户以及相应的密码。 其在文件中的存储方式是:用户名=密码,如: lily=123456 表示新增一个用户,用户名是:lily,密码是:123456 二、groups.properties: 持有群体的用户映射,可以通过组而不是单个用

  • Apache Apollo是一个代理服务器,主要用于消息的请求转发,下面是其常用的一些配置文件的介绍 一、users.properties: 用来配置可以使用服务器的用户以及相应的密码。 其在文件中的存储方式是:用户名=密码,如: lily=123456 表示新增一个用户,用户名是:lily,密码是:123456 二、groups.properties: 持有群体的用户映射,可以通过组而不是单个用

  • 代码目录结构 Map的代码目录结构如下 ├── data // 生成好的地图 │ └── demo ├── hdmap // 高精度地图 │ ├── adapter // 从xml文件读取地图(opendrive保存格式为xml) │ │ └── xml_parser │ └── test-data ├── pnc_map

  •  在服务应用的配置中加入以下配置(本例子中的文件为application.yml) app.id为在服务端web页面上创建的项目APP的id apollo.meta为apollo服务端的地址 apollo.cluster为要配置的集群名称,如果没有可不填 apollo.cacheDir为自定义缓存路径 apollo.bootstrap.enable为是否在工程启动的bootstrap阶段向Spri

 相关资料
  • Apollo(阿波罗)是携程框架部门研发的分布式配置中心,能够集中化管理应用不同环境、不同集群的配置,配置修改后能够实时推送到应用端,并且具备规范的权限、流程治理等特性,适用于微服务配置管理场景。 Swoft 基于 Apollo 提供的 API,在之上进行封装,使之能在 Swoft 中快速使用。 安装 swoft/whoops 作为一个额外的扩展组件,需要手动安装: Composer 安装 com

  • Apollo以ActiveMQ原型为基础,是一个更快、更可靠、更易于维护的消息代理工具。Apache称Apollo为最快、最强健的 STOMP(Streaming Text Orientated Message Protocol,流文本定向消息协议)服务器。 Apollo的特性如下: 支持Stomp 1.0和Stomp 1.1协议 主题和队列 队列浏览器 主题持久订阅 镜像队列 可靠的消息传递 消

  • Cache 中间件让你的应用可以非常简单的将对象保存到各种临时或者永久存储中。包括 memory, file, Redis, Memcache, PostgreSQL, MySQL, Ledis and Nodb. 安装 go get github.com/tango-contrib/cache 默认使用memory存储 package main import ( "github.com/

  • fis.cache~ Cache new Cache(path, dir) Cache 构造器,在 fis 中主要用于缓存目标文件的编译信息和编译结果。 Parameters: Name Type Description path String 需要被缓存的文件路径。 dir String 缓存目录。 Source: cache.js, line 11 Methods addDeps(filepa

  • fis. cache 用来创建 ~Cache 对象, 更多细节请查看 ~Cache 说明。 Source: cache.js, line 145 See: Cache 类说明 Example // 检查该文件是否启用缓存 if (file.useCache) { // 如果启用,则创建 cache 对象 file.cache = fis.cache(file.realpath, CA

  • 一个简单的缓存系统,内部使用FileLoader。 代码示例 要在所有使用FileLoader的加载器上启用缓存, 需设置 THREE.Cache.enabled = true. 例子 WebGL / geometry / text WebGL / interactive / instances / gpu WebGL / loader / ttf 属性 .enabled : Boolean 是否