摘要:
场景 web服务器有多台,每台服务器都会存贮自己的session,session无法在多台服务器共享。所以就需要更换session的存贮空间,存贮在一个共用的空间。通常为了读写速度,我们会选择存贮在内存服务上,如redis、mysql的memory存贮引擎等,本文以reddis存贮贯串上下文。 se 阅读全文
摘要:
[TOC] 依赖倒置(DIP) 依赖倒置原则(Dependence Inversion Principle,DIP):High level modules should not depend upon low level modules.Both shoulddepend upon abstract 阅读全文
摘要:
[TOC] module Go 在 1.11 之后推出了依赖包管理工具 Go Modules,使得开发者可以在 GOPATH 指定的目录外组织项目代码。 官方go module wiki "go/wiki/Modules" ; "Introduction to Go Modules" 是一篇很好的g 阅读全文
摘要:
[TOC] 开放封闭原则 Software entities like classes,modules and functions should be open forextension but closed for modifications.(一个软件实体如类、模块和函数应该对扩展开放,对修改关 阅读全文
摘要:
[TOC] 工厂模式 Define an interface for creating an object,but let subclasses decide whichclass to instantiate.Factory Method lets a class defer instantiat 阅读全文
摘要:
[TOC] 单列模式 Ensure a class has only one instance, and provide a global point of access to it.(确保某一个类只有一个实例,而且自行实例化并向整个系统提供这个实例。) 线程不安全 "懒汉模式" 懒汉模式存在线程安 阅读全文