`
xiangzhouwang
  • 浏览: 6330 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

快速开发框架hpv介绍

阅读更多
http://www.hpvcms.com/index/494

快速开发框架hpv是Spring,hibernate,Struts tiles整合的框架。 Spring: 用到IOC, IOC中的afterPropertiesSet 比较好用,还有spring mvc Hibernate: 只用critera, no SQL, no hql Struts:只用到tiles,前台用JSTL,便于移植。

目标
以user为例,代码生成器Auto按表生成代码:

Core工程:

•表User   :定义dbobject的业务对象,利用hibernate生成表SQL
•User VO
•UserMapper :mapper between db and vo
•UserDao
•UserManager:接口方法load(long id)   remove(long id)  update(vo)  add(vo), loads(Cnd),updates(vos),removes(vos)
Web工程

•UserController
•User Tiles配置文件
•User JSP文件
生成的代码后,要业务需要定义表结构VO对象,自动生成数据库表,完成controller和jsp代码。




二级缓存
二级缓存(hot cache)机制:key-----value by LRU

dao需要引入缓存(重写二级缓存,实现命中率80%以上)



key-value

record cache:

id--------------db

public cache:
field=value&field=value----------------------List

secondory cache:
hotfield=value&field=value&field=value:---------------------List
when hotfield=value--------------------------map

in map when &field=value&field=value---------------------List



失效原则:

•field: change from value to new value
•when public cahe contain field, remove public cache by key
•when secondory cahe hotfield=field, remove secondory cache by key
失效在transaction submit 以后。

以上一切按照 template pattern设计。

命中率: 过期时间越长,map size越大,命中率越高

Lazy:  lazySave= lazyupdate and lazyadd, 比如文章的点击数,可以设定每几分钟保存一次







mvc
目标:只要写一个方法体,和JSP页面即可,也不需要配置XML

•C:采用spring mvc,简化很多,重写新的dispather,实现集中invoke,只要写method然后invoke,   约定:http://domain/class/method.htm,实现controller的模块化和方便method之间redirect.同时 wrap request and response ,增加utility
•V:页面有tiles做管理,减少脏代码的注入,可以有效实现页面重用,在结合ajax时可以有效实现局部页面的定制和刷新
•M: no getter/setter, copy(only/ignore) fields from object to object, or copy reference fields by annotation
页面缓存:同理属于vocache,支持本地hash map或者 disc cache或者net cache.页面缓存的实效时间可定制,页面缓存的颗粒度要小,而且要可参数化(结合urlrewrite)

伪静态化:urlrewriter可以有效的实现,有助SEO

ajax,xml,jason:简单,不累述


优势
•时间:省50%以上
•效率:减少DB增加mem, local cache(hashmap and disk cache)----net cache(memcache)
•相关技术:spring,tiles,hibernate,jstl,quarz,lucene,nio,urlrewritefilter,ehcache,c3p0,log4j,threadpool,memcache,LRUcahce....
•没有表之间的join操作,既然no join, 就需要冗余,冗余的同步是off line的,threadpool 中quarz实现



成功案例
4大系统, blog+bbs+shop+pms,共5w行代码,3w多行是自动生成,数据库表160个,页面350个,开发成本减少一半以上,精力都在业务端


分享到:
评论
1 楼 JavaTear2014 2013-05-28  
楼主是牛人!

相关推荐

Global site tag (gtag.js) - Google Analytics