Skip to content

Adds redis cache for distributed environments #2691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 17, 2016
Merged

Conversation

flovilmart
Copy link
Contributor

No description provided.

@codecov-io
Copy link

codecov-io commented Sep 10, 2016

Current coverage is 92.31% (diff: 100%)

Merging #2691 into master will increase coverage by 0.05%

@@             master      #2691   diff @@
==========================================
  Files           102        103     +1   
  Lines         12449      12539    +90   
  Methods        1559       1583    +24   
  Messages          0          0          
  Branches       2039       2043     +4   
==========================================
+ Hits          11486      11576    +90   
  Misses          963        963          
  Partials          0          0          

Powered by Codecov. Last update ba0e529...fce4601

@ghost
Copy link

ghost commented Sep 10, 2016

@flovilmart updated the pull request - view changes

@ghost
Copy link

ghost commented Sep 10, 2016

@flovilmart updated the pull request - view changes

@flovilmart
Copy link
Contributor Author

Also sets the PG tests to allow failure until we figure out good repro steps, at least the history will be kept in travis, and build won't fail for bad reasons.

@flovilmart flovilmart modified the milestone: 2.2.20 Sep 10, 2016
@drew-gross
Copy link
Contributor

Can you add some docs for this one as well?

@flovilmart
Copy link
Contributor Author

On the wiki yes!

@mmarshak
Copy link

@flovilmart adding support for caching on the server is great.
Is there a place I can see an example how to use Redis in Cloud Code?

Thanks

@flovilmart
Copy link
Contributor Author

This isn't for cloud code, this is for the internal cache.

@ghost
Copy link

ghost commented Sep 17, 2016

@flovilmart updated the pull request - view changes

@mmarshak
Copy link

Is there any way you suggest to use some type of caching in cloud code.
For example I want to build a cache on the server to save result of previous queries with time stamps, and when I get the same query from another user I can check first the local cache to see if I have a recent result, if not issue the query to MongoDB via Parse server.

@flovilmart
Copy link
Contributor Author

You would have to use cloud functions for that.

@mmarshak
Copy link

Right, but do you have any suggestion for how to cache the data in cloud function over future calls. I can create something from scratch, but I am sure their is already good other solution that other used, as this should be a common need by many to improve performance.

@flovilmart
Copy link
Contributor Author

Again, that is not the purpose of that adapter. it's only purpose is the same as the original InMemoryCacheAdapter. For other caching mechanisms you should not use that, as we internally flush the cache entirely.

@mmarshak
Copy link

I understand that I should not use it. My question was do you have advise about another cache mechanism I can use in cloud code that will be persistent as long the server is up? If server is restarted I will rebuild the cache from scratch.

@flovilmart
Copy link
Contributor Author

You should probably as those questions over stackoverflow or stackexchange. I have no suggestion for building such cache as it depends on many parameters.

@drew-gross
Copy link
Contributor

Cool. I see the docs now. @mmarshak since Cloud Code in parse-server is run in node, you can use any of the available caching libraries on npm within your Cloud Code. That could mean a pure-js, in memory cache adapter, or you could install a redis or memcached javascript client and use it directly within your Cloud Code.

@mmarshak
Copy link

@drew-gross thank you for the pointers.

@flovilmart flovilmart deleted the redis-cache branch September 17, 2016 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants