We want to enable cache only for a specific graphql query. I created the cache and chose "per-resolver caching" in appsync console. Then I enabled cache inside the query resolver. However, the caching metric shows no cache hits or misses. It seems the query was not cached at all and the request still went to the data source as indicated from backend logging.
Enabling full-request caching from console works fine for all queries. Has anyone seen the similar issues? Do I need to explicitly set the cachingConfig for the resolver? Thank you for any help!
Problem was solved. It turns out that I need to save the updated cache config...
Related
I own a Shopify store that does flash sales. It uses cloudflare to manage the server caching of my products.json file. However, it seems like people are able to monitor my products.json and bypass the cache. I want the cache there because it reduces server load and also prevents people from botting my sales because they can't see exactly when I update my products.
They are constantly receiving X-Cache: miss when I'm expecting to return hit, server.
Does anyone know how they might be doing this and how I can go about stopping it?
Thanks.
know you all are looking for a cache bypass
There's a thread in the Shopify community forum regarding calls to the products.json file: https://community.shopify.com/c/Shopify-APIs-SDKs/product-json-API/td-p/328448
I'm building an Apollo app that needs to have offline support.
I understand that Apollo allows us to have direct control to the cache using apollo-cache-inmemory, and with method like writeQuery we are able to mutate the cache data without changing the data on the server.
What's the best approach to sync local cache data with the server, let's say, on a scenario where the app could go offline for a period of time?
AWS AppSync will handle this for you and has an Apollo plug in:
yarn add aws-appsync
yarn add aws-appsync-react
This will perform offline caching and automatic synchronization as well as conflict resolution. You can also control Optimistic UI using the AppSync plugin and Apollo: https://docs.aws.amazon.com/appsync/latest/devguide/building-a-client-app-react.html#offline-settings
Did you see this one? Maybe it can help....
https://dev-blog.apollodata.com/announcing-apollo-cache-persist-cb05aec16325
I have a web application. The authentication tokens are stored in in-memory cache and not stored in database. I am using Couchbase for caching. During deployment of application, the cache will be lost and all the users will be logged out subsequently as tokens are stored in cache. What can I do to prevent my cache from being lost? I still don't want to use database for storing tokens.
Are you flushing your buckets intentionally? Or you mean you are using "memcached" type of buckets which do not survive reboot?
I would recommend you to setup "couchbase" type of the bucket, and use expiration time when you are storing session. In this case you will have persistent session, but still not run out of space, because of old inactive sessions will be removed automatically.
I was wrong. The cache persists. Even after rebooting the server. Strange but yes it does. May be, couchbase flows cache to disk on rebooting. Also, my use case involved Spring which rules out possibility of using "memcached" type bucket.
I have an iOS app that is using Parse Server, and I noticed that a lot of my queries are made on tables that are not changing often.
I would like to know if it's possible to cache (for instance every day) some of these requests using Parse Server in order to limit resources used and improve my capacity.
Thanks for your help.
Cyril
For now we don't provide caching mechanisms, but you could implement it through a reverse proxy or another strategy in the front of your parse-server
For example, you can configure it with nginx, to cache the requests and serve them before you hit your parse-server installation
https://www.nginx.com/resources/wiki/start/topics/examples/reverseproxycachingexample/
I want to disable doctrine's default caching for a specific function(page), on all other pages, it should work as usual. Also I don't even want to clear the current caching inside that function. Just need that, no caching will be considered for that particular function call and its inside workflow.
Is there any easy way to achieve this? Thanks.
Rana, I believe you can use $query->useResultCache(false); to disable the cache for the page you want. Take a look at the documentation if needed.
Cheers,
You could use another entity manager for that specific page with caching turned off. As you didn't mention what kind of framework you use, I am unable to make any further assumptions.
According to the documentation (and personal experience) you shouldn't use doctrine without a cache:
Do not use Doctrine without a metadata and query cache! Doctrine is optimized for working with caches. The main parts in Doctrine that are optimized for caching are the metadata mapping information with the metadata cache and the DQL to SQL conversions with the query cache. These 2 caches require only an absolute minimum of memory yet they heavily improve the runtime performance of Doctrine. The recommended cache driver to use with Doctrine is APC. APC provides you with an opcode-cache (which is highly recommended anyway) and a very fast in-memory cache storage that you can use for the metadata and query caches as seen in the previous code snippet.
Would you mind sharing that specific need of yours to be able to provide you with a better answer/solution to your problem?