Comments (22)
Play is a good role model:
Memcached configuration
~~~~~
Enable memcached if needed. Otherwise a local cache is used.
memcached=enabled
Specify memcached host (default to 127.0.0.1:11211)
memcached.host=127.0.0.1:11211
Or you can specify multiple host to build a distributed cache
memcached.1.host=127.0.0.1:11211
memcached.2.host=127.0.0.1:11212
from ninja.
i suggest to use guava cache
http://code.google.com/p/guava-libraries/wiki/CachesExplained
for local cache is already done and perfect, and later, i will impl hazelcast and\or memcache storage for distributed cache.
probably need to create some NinjaCacheManager class
from ninja.
Hi zoza,
I would closely model it after an interface from Play 1:
https://github.com/playframework/play/blob/master/framework/src/play/cache/Cache.java
Then we can use different Cache Implementations under the hood. The guava cache is for sure a pretty good idea if the cache should live on one machine. In other cases EhCache might be useful...
But a must is memcached - especially when scaling up the instances...
Cheers,
Raphael
from ninja.
Play cache is very simple delegate interface. For low level usage it's
mandatory.
But in addition, I was thinking about some annotations based cache like
spring has. (For controller.action or any method cache)
15.02.2013 11:53 пользователь "reyez" [email protected] написал:
Hi zoza,
I would closely model it after an interface from Play 1:
https://github.com/playframework/play/blob/master/framework/src/play/cache/Cache.java
Then we can use different Cache Implementations under the hood. The guava
cache is for sure a pretty good idea if the cache should live on one
machine. In other cases EhCache might be useful...But a must is memcached - especially when scaling up the instances...
Cheers,
Raphael
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-13599632.
from ninja.
Also please look at hazelcast
15.02.2013 11:53 пользователь "reyez" [email protected] написал:
Hi zoza,
I would closely model it after an interface from Play 1:
https://github.com/playframework/play/blob/master/framework/src/play/cache/Cache.java
Then we can use different Cache Implementations under the hood. The guava
cache is for sure a pretty good idea if the cache should live on one
machine. In other cases EhCache might be useful...But a must is memcached - especially when scaling up the instances...
Cheers,
Raphael
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-13599632.
from ninja.
i started to implement
from ninja.
On Wed, Mar 13, 2013 at 4:37 PM, Anatoly [email protected] wrote:
i started to implement
cool :) please post really early and really often so we can discuss stuff...
I'd really love to see:
- An interface like http://www.playframework.com/documentation/1.2.5/cache
- Different implementations for the interface (EhCache would be my
favorite for now)
Binding the interface with the implementation is of course done simply via
guice...
Cheers!
Raphael
from ninja.
as a concept it will be as play 1 cache.
I'm planing to implement 3 basic backends: memcache, ehcache and hazelcast
i want to create 1 maven project (jar at the end): cache-manager with
basic impls (without any deps for ninja or guice)
1 maven project: cache-manager-guice with annotations and guice aop (like
spring cache)
Binding the interface with the implementation is of course done simply via
guice...
yes, only interface CacheManager that binded to SomeImplCacheManager as
singleton
On Wed, Mar 13, 2013 at 10:41 PM, reyez [email protected] wrote:
On Wed, Mar 13, 2013 at 4:37 PM, Anatoly [email protected] wrote:
i started to implement
cool :) please post really early and really often so we can discuss
stuff...I'd really love to see:
- An interface like
http://www.playframework.com/documentation/1.2.5/cache- Different implementations for the interface (EhCache would be my
favorite for now)Binding the interface with the implementation is of course done simply via guice...
Cheers!
Raphael
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-14867161
.
from ninja.
On Wed, Mar 13, 2013 at 11:03 PM, Anatoly [email protected] wrote:
as a concept it will be as play 1 cache.
I'm planing to implement 3 basic backends: memcache, ehcache and hazelcasti want to create 1 maven project (jar at the end): cache-manager with
basic impls (without any deps for ninja or guice)
1 maven project: cache-manager-guice with annotations and guice aop
(like
spring cache)Binding the interface with the implementation is of course done simply
via
guice...
yes, only interface CacheManager that binded to SomeImplCacheManager as
singleton
sounds perfect :)
cheers,
raphael
from ninja.
Once that is up and running it should be really simple to cache the response of a controller method via a filter like:
@FilterWith(PageCache.impl)
:)
from ninja.
no, its not.. :)
that about eviction??
if i change something (with another method) that change the response ????
also, what about a cache key (method params) ??
On Thu, Mar 14, 2013 at 10:47 AM, reyez [email protected] wrote:
Once that is up and running it should be really simple to cache the
response of a controller method via a filter like:
@FilterWith(PageCache.impl):)
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-14891829
.
from ninja.
first commit:
https://github.com/zoza/cache-manager
from ninja.
On Thu, Mar 14, 2013 at 11:55 AM, Anatoly [email protected] wrote:
first commit:
https://github.com/zoza/cache-manager—
Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-14896359
.
looks good to me :)
from ninja.
im just now comited some code
please look closely, if you have any comments
On Thu, Mar 14, 2013 at 6:48 PM, reyez [email protected] wrote:
On Thu, Mar 14, 2013 at 11:55 AM, Anatoly [email protected]
wrote:first commit:
https://github.com/zoza/cache-manager—
Reply to this email directly or view it on GitHub<
https://github.com/reyez/ninja/issues/22#issuecomment-14896359>
.looks good to me :)
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-14914069
.
from ninja.
few questions:
about increment\decrement:
i can implement that you need to call put method before (to init the counter) or null will returned
or add some putIfAbsent inside the incr method, that will actually work only first time (call) (but a little slow)
also about exceptions:
throw ex in case of error (and define them in methods) or throw runtime ex or return null ???
from ninja.
On Sun, Mar 17, 2013 at 3:32 PM, Anatoly [email protected] wrote:
few questions:
about increment\decrement:
i can implement that you need to call put method before (to init the
counter) or null will returned
or add some putIfAbsent inside the incr method, that will actually work
only first time (call) (but a little slow)also about exceptions:
throw ex in case of error (and define them in methods) or throw runtime ex
or return null ???
Hi Anatoly,
I did not use the increment decrement functionality myself. I would just
mimic how Play (or Rails) handles it.
Regarding exceptions => I'd also mimic the behavior of Play. The good thing
is that a user should never ever rely on a cache to work. So returning null
should be always okay...
Cheers,
Raphael
from ninja.
im comited some code
please look closely, if you have any comments
from ninja.
On Fri, Mar 29, 2013 at 4:00 PM, Anatoly [email protected] wrote:
im comited some code
please look closely, if you have any comments
Hi zoza,
I'll have a look next week. Sorry, I am a bit busy right now :(
Thanks!
Raphael
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-15644488
.
inc: http://ars-machina.raphaelbauer.com
tech: http://ars-codia.raphaelbauer.com
web: http://raphaelbauer.com
from ninja.
- I'd change the package to something more detailed... (Yes - I know ninja also has only "ninja", but it is usually bad pratice - especially with a generic "cache"...)
- Do you plan to release the project to maven central?
- In what projects do you intend to use the cache manager? => Will the
library be maintained a bit? Because if you want we could move it (with
guice binding I guess) to Ninja as well... - Why not use simple classes and interfaces and bind them via guice?
- I'd need something to customize stuff further. eg "/memcache.ini" and so
on => In reality this should come from NinjaProperties (in case of ninja).
=> Therefore a guice provider would be cool again.. :)
Just my quick remarks. I really like what I see - (testcases hooray!) Good
work!
Best,
Raphael
from ninja.
- no problem. see 2 and 3
- no. you do. :) (as part of ninja)
- i think, we need to add this as maven jar (ninja-cache) to ninja like ninja-servlet
- that what i'm done, no?? or explain... (see https://github.com/zoza/cache-manager-guice)
- no problem. the only thing i want -- cache-manager should be configured and work easily without ninja and cache-manager-guice with any guice app. (as maven dep)
=> Therefore a guice provider would be cool again.. :) => see https://github.com/zoza/cache-manager-guice
from ninja.
Hi zoza,
If you want to independently use the lib you should put it under your own namespace and upload it to the maven repo. We can then use that for ninja.
Ninja ideally would only use simple interfaces (ninja.cache or so) that are then bound to your cache manager.
We can also integrate that into Ninja like what you proposed with ninja-servlet. We could also host it as external library (something like https://github.com/reyez/ninja-ebean).
To sum it up: Just fork Ninja and integrate it the way you want :) We can discuss stuff then :)
Best,
Raphael
from ninja.
cache layer now integrated via ehcache and memcached
from ninja.
Related Issues (20)
- SuperDevMode issue on VirtualBox "Shared Folder"
- How to return HttpServletResponse
- Is Ninja-Framework safe regarding "Critical New 0-day Vulnerability in Popular Log4j Library"? HOT 4
- Is it still active? / Looking for maintainers? HOT 2
- Problem using Validation & DTO (v6.8.1) HOT 1
- Issue with deployed WAR : Application seems run twice HOT 1
- Websockets are not initialised error HOT 3
- dependency scope setting issues
- Retrieve url path from template
- Ninja 6.9.0 : Configure Jetty ThreadPool HOT 1
- Code optimization suggestions
- Does anyone use it to build microservices
- Test Smell: it is not a good practice to write return statement in test case
- X-Forwarded-For does an insecure internal DNS lookups for user-provided hosts
- How to integrate socket into ninja and start it with ninja program, not websocket
- Some flaky tests
- Exclude field from depths (nested relation) on create_schema function
- org.hibernate.HibernateException: HHH000142: Javassist Enhancement failed: models.Article
- Insecure Cookie Encryption due to usage of insecure mode of operation when doing AES cipher
- Ninja send unexpected content type
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ninja.