Is there any caching mechanism in Slick? - scala

I'm new in Slick and Play and I can't find any references about caching in docs(2 and 3rc). Is there any native way in Slick for cache organization or if not tell me, please, why and whats the reasons for not having it? Summary, I hope that somebody help me in this question or show another better way.

I don't think Slick has got anything, it is just for interacting with a RDBMS. But since you are using play framework you have the play cache API:s that you can use, for example in a DAO that wraps Slick. You can read more about it in the play framework docs here: https://www.playframework.com/documentation/2.3.x/ScalaCache

Also see http://slick.typesafe.com/doc/2.1.0/orm-to-slick.html#read-caching and the following section

Related

PostgreSQL and Scala - Non-Blocking API

I would like to know if here is any library that I could use to do asynchronous database calls? I'm using PostgreSQL as my database. I came to know about slick. Is that non-blocking? Any suggestions?
From Slick documentation What is Slick?
Execution of database actions is done asynchronously, making Slick a perfect fit for your reactive applications based on Play and Akka.
In addition to Slick as mentioned by #Jean there is also ScalikeJDBC-async build on top of postgresql-async.

Play framework 2 scala with MongoDB

I am new in play framework 2.
I have play 2 with scala and MongoDb requirement.
I searched lots on Play 2 and MongoDb connection, but didn't find any useful documentation.
There is lots of plugins available eg. Casbah, Reactive Mongo, Salat. So which is best for use, and which have better future?
If i want to implement my own connection to Mongo without using third party plugin, is it possible?
Please give examples and document on Play 2 and MongoDB connection.
I suggest using ReactiveMongo as its non-blocking approach is similar to how Play itself works. The API works with scala Futures which is a a really nice fit with Play's Async actions. You can also use their macros to convert case classes straight to BSON sparing quite some boilerplate code.
A lot of time has passed but I would like to share an update for those, who may search for Scala MongoDB client library for Play Framework.
Reactive Mongo is great but still lacks Play Framework 2.4 integration and MongoDB 3.0. We have waited for a long time thus wrote a library that wraps original MongodDB client in the Scala style way and is similar to Reactive Mongo in the api. Take a look at https://github.com/evojam/play-mongodb-driver. With the Play Framework module it's pretty straightforward to start, like few minutes to get working code.
This way MongoDB is nice and easy to use in Scala. We have provided a comparison of the sample query execution is in our blog post about the driver on site.

CRUD operations on a database in Play

I'd like to be able to create/delete/change a database and tables, create/delete indexes and all these kinds of things by Scala code, not by an sql file. Probably, using anorm. Is wonder, is it possible?
I know it's possible to do CRUD operations with tables.
Slick is a Scala ORM that can do most of what you're asking for, however it does not have a pure Scala way of creating a new database. You can read more about that here.
You say you are using play then start off using Ebean ORM
Have a look at
Play Persistance
and
Avaje EBean
If you have downloaded play look in the samples directory there is a computer database example. It is a very good example of CRUD
Good luck
I would recommend slick! Slick at first seems different if you are moving from directly stating your statements, but it is super handy to work with. Check it out here

Resquest MongoDB with scala

I want to do an application in Scala, with a MongoDB database. I found some tutorials to use it with ReactiveMongo, I wrote my classes, but I want to test it and I don't understand how to do a simple request; to add a user for example, or find him.
What is the right method to use?
You could use the Activate framework. It supports ReactiveMongo with a simple usage interface for queries and modifications.
Using it, is also easy to switch to other types of databases, like postgre and mysql.
http://activate-framework.org/
It uses transparent persistence with efficient memory usage, providing a simpler persistence paradigm with high scalability. Take a look at http://databen.ch
Do you want ReactiveMongo or just want to use mongodb on scala. If it's the lastest, try http://mongodb.github.io/casbah/tutorial.html
Is what we use in our projects...

JPA and Mysql query on play framework

I am new and i need help about using JPA on play framework.
Anyone can give me a sample about convert mysql query to JPA? or good Tutorials?
Better with example or sample code. thanks a lot.
Play!Framework has very good documentation on this topic, go and check http://www.playframework.org/documentation/1.2.4/jpa#finding.
You can also find many useful code from the samples packaged in the installation package