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
// 1992年: https://ir.nctu.edu.tw/bitstream/11536/3533/1/A1992HE70800003.pdf | |
// 1997年: http://msn.iecs.fcu.edu.tw/~ccc/profile/publish/ij_paper2/IJ-135.pdf | |
// 2000年: https://ir.nctu.edu.tw/bitstream/11536/30118/1/000166289900002.pdf | |
import scala.math.BigInt | |
sealed class PermissionCompound(protected val value: BigInt) { self => | |
def +(that: PermissionCompound): PermissionCompound = PermissionCompound( | |
self.value * that.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
@startuml | |
title: 1マイクロサービスにおける依存関係図 | |
scale 0.6 | |
package "xxxApiExternalAdapter" as extA { | |
frame "PlayFramework" { | |
[Controller] | |
[Presenter] | |
[InputJson] |
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
class RedisClientImplSpec extends AbstractSpecification { | |
import Matchers._ | |
import Mockito._ | |
import monix.execution.Scheduler.Implicits.global | |
import RedisClientImplSpec._ | |
println("---------------------------------------------") |
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
class RedisClientImpl @Inject()( | |
system: ActorSystem | |
)( | |
host: String, | |
port: Int, | |
password: Option[String], | |
dbNum: Option[Int] | |
) extends RedisClient { |
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
sealed abstract class CacheIO[+A] {} | |
object CacheIO extends CacheIOCreation { | |
case class Put[T]( | |
key: CacheKey, | |
value: T, | |
expireSecond: Option[Long], | |
fmt: ByteStringFormatter[T] |
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
trait CacheIOInterpreter { | |
// Effects of type R, returning a value of type A | |
def run[R, U, A](effects: Eff[R, A])( | |
implicit m: Member.Aux[CacheIO, R, U], | |
m1: _readerRedisClient[U], | |
m2: _writerLogMsg[U], | |
m3: _errorEither[U], | |
m4: _task[U] | |
): Eff[U, A] = { |
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
// ↓のようにもかけるがテストしづらいのでやめた | |
//val t = c.multi( redis => { | |
// redis.select(Tag.unwrap(dbNum)) | |
// redis.get(Tag.unwrap(key) | |
//}) | |
// 動的DB変更案はトランザクションにロールバックがないredisで、 | |
// 複数コマンド叩かないと整合性が取れない状態を生みやすいので厳しいかも | |
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
sealed abstract class RedisClient { | |
def put[A: ByteStringFormatter]( | |
key: CacheKey, | |
value: A, | |
expireSeconds: Option[Long] = None | |
): Task[\/[EsError, A]] | |
def putList[A: ByteStringFormatter]( | |
key: CacheKey, |
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
import scalaz.Functor | |
// Functor(F)と、計算値(A)を型パラメータでとる | |
// mapとflatMapを持ち、Pureなら関数適用、InpureならFunctorを使ってFの計算値(A)にfを適用する | |
sealed abstract class Free[F[_], A] { | |
import Free._ | |
def map[B](f: A => B)(implicit F: Functor[F]): Free[F, B] = |
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
// コンテナ型Fに対してmapを持つ | |
trait Functor[F[_]] { | |
def map[A, B](fa: F[A])(f: A => B): F[B] | |
} | |
implicit def functorOps[F[_]: Functor, A](self: F[A]) = new { | |
def map[B](f: A => B): F[B] = implicitly[Functor[F]].map(self)(f) | |
} |
NewerOlder