Skip to content

Instantly share code, notes, and snippets.

@iocopocomaioco
iocopocomaioco / gist:3832574
Created Oct 4, 2012
Redis Server - Cli commands
View gist:3832574
BGREWRITEAOF -
summary: Asynchronously rewrite the append-only file
BGSAVE -
summary: Asynchronously save the dataset to disk
CONFIG GET parameter
summary: Get the value of a configuration parameter
CONFIG RESETSTAT -
View gist:3830624
//method 1
import java.util.UUID
uuid = UUID.randomUUID()
//method 2
import static java.util.UUID.randomUUID
uuid = randomUUID()
@iocopocomaioco
iocopocomaioco / gist:3828584
Created Oct 3, 2012
Using Redis with - or without - hybernate
View gist:3828584
>> Using Redis Standalone > must uninstall the Hybernate plugin
grails uninstall-plugin hibernate
With this done all domain classes in grails-app/domain will be persisted via Redis and not Hibernate.
>> If you want to persist a particular domain class with Redis then you must use the mapWith property in the domain class:
static mapWith = "redis"
@iocopocomaioco
iocopocomaioco / gist:3828362
Created Oct 3, 2012
Standard GORM domain class in Grails
View gist:3828362
package 'packageName'
import 'whateverPackagesYouNeed'
// note: a GORM class can extend another - default behaviour is: they will be on same table
class User extends SecUser{
// on IDs - you must either set yorseld - or choose generation method
String userId
@iocopocomaioco
iocopocomaioco / gist:3828249
Created Oct 3, 2012
Basic grails commands
View gist:3828249
grails create-domain-class 'classpath&classname'
grails create-controller 'classpath&classname' // for a domain class
grails create-view 'classpath&classname' // for a domain class
grails create-all 'classpath&classname' // for a domain class
grails generate-controller 'classpath&classname' // for a domain class
grails generate-view 'classpath&classname' // for a domain class
grails generate-all 'classpath&classname' // for a domain class
grails run-app 'appname'