You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- <?php
- //领域层主要是关注复杂业务的处理,以及缓存的处理、耗时操作后台异步处理等,并调用Model持久层获取需要的数据。因此,是Api与Model层之间的桥梁。
- class Domain_User {
-
- public function getBaseInfo($userId) {
- $rs = array();
-
- $userId = intval($userId);
- if ($userId <= 0) {
- return $rs;
- }
-
- // 版本1:简单的获取
- $model = new Model_User();
- $rs = $model->getByUserId($userId);
-
- // 版本2:使用单点缓存/多级缓存 (应该移至Model层中)
- /**
- $model = new Model_User();
- $rs = $model->getByUserIdWithCache($userId);
- */
-
- // 版本3:缓存 + 代理
- /**
- $query = new PhalApi_ModelQuery();
- $query->id = $userId;
- $modelProxy = new ModelProxy_UserBaseInfo();
- $rs = $modelProxy->getData($query);
- */
-
- return $rs;
- }
- }
|