This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=microcache:5m max_size=1000m; | |
server { | |
listen 80; | |
server_name cache.example.ru; | |
# кешируемый адрес | |
location / { | |
# кеш включен по умолчанию | |
set $no_cache ""; | |
# отключаем кеш для всех методов, кроме GET и HEAD | |
if ($request_method !~ ^(GET|HEAD)$) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// (1). Simplified - A Thing[A] to compute another Thing[B] | |
// Thing[A] is like a simplest posssible container for a value and the | |
// pattern, given a Thing[A], and a function flatMap, pulls a value of | |
// type A out of the Thing[A] and applies the function flatMap() on this | |
// value of type A and returns another new Thing[B] with a value of | |
// type B injected into it by the constructor (apply() method here) | |
// encapsulates a monad in loose sense | |
case class Thing[+A](value: A) { | |
def flatMap[B](f: A => Thing[B]) = f(value) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// my response to https://groups.google.com/forum/?fromgroups#!searchin/play-framework/cake/play-framework/LQ2y40QNZaE/qvRFw5of-rQJ | |
import play.api._ | |
import play.api.mvc._ | |
// Domain object | |
case class User(id: String, name: String) | |
// Trait defining the service component | |
trait UserServiceComponent { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns | |
Compress 1K bytes with Zippy 3,000 ns | |
Send 2K bytes over 1 Gbps network 20,000 ns | |
Read 1 MB sequentially from memory 250,000 ns | |
Round trip within same datacenter 500,000 ns | |
Disk seek 10,000,000 ns |