ER图:如何管理会话?(并行drupalsymfony2)

ER图:如何管理会话?(并行drupalsymfony2),drupal,session,session-variables,symfony,er-diagrams,Drupal,Session,Session Variables,Symfony,Er Diagrams,我正在构建我的应用程序,对会话存储感到恼火。我是一个会话新手。我正在使用Symfony2和MySQL,由于Symfony对存储是不可知的,所以我正在搜索以找到一个好的模型 所以我想知道两件事: 如何在实体关系图中管理会话? 在Drupal7图表中,会话->字段是什么意思? 会话->uid int10->确定 会话->sid varchar128? 会话->ssid varchar128? 会话->主机名varchar128->确定 会话->时间戳int11->猜测连接日期 会话->缓存int11

我正在构建我的应用程序,对会话存储感到恼火。我是一个会话新手。我正在使用Symfony2和MySQL,由于Symfony对存储是不可知的,所以我正在搜索以找到一个好的模型

所以我想知道两件事:

如何在实体关系图中管理会话? 在Drupal7图表中,会话->字段是什么意思? 会话->uid int10->确定 会话->sid varchar128? 会话->ssid varchar128? 会话->主机名varchar128->确定 会话->时间戳int11->猜测连接日期 会话->缓存int11->为什么只有整数? Sessions->session longblob->你在里面放了什么? 正如我想象的那样,我有两个表:

存储会话ID、cookie和建立日期的会话 用户会话,会话和用户之间的关联,存储IP地址和DateInit。 为什么不通过Cookie存储一个会话,并在用户每次连接时存储呢?
如果有人能帮助我理解并帮助我找到真正的实体关系模型…

Drupal 7中会话表的功能描述如下:

  $schema['sessions'] = array(
    'description' => "Drupal's session handlers read and write into the sessions table. Each record represents a user session, either anonymous or authenticated.", 
    'fields' => array(
      'uid' => array(
        'description' => 'The {users}.uid corresponding to a session, or 0 for anonymous user.', 
        'type' => 'int', 
        'unsigned' => TRUE, 
        'not null' => TRUE,
      ), 
      'sid' => array(
        'description' => "A session ID. The value is generated by Drupal's session handlers.", 
        'type' => 'varchar', 
        'length' => 128, 
        'not null' => TRUE,
      ), 
      'ssid' => array(
        'description' => "Secure session ID. The value is generated by Drupal's session handlers.", 
        'type' => 'varchar', 
        'length' => 128, 
        'not null' => TRUE, 
        'default' => '',
      ), 
      'hostname' => array(
        'description' => 'The IP address that last used this session ID (sid).', 
        'type' => 'varchar', 
        'length' => 128, 
        'not null' => TRUE, 
        'default' => '',
      ), 
      'timestamp' => array(
        'description' => 'The Unix timestamp when this session last requested a page. Old records are purged by PHP automatically.', 
        'type' => 'int', 
        'not null' => TRUE, 
        'default' => 0,
      ), 
      'cache' => array(
        'description' => "The time of this user's last post. This is used when the site has specified a minimum_cache_lifetime. See cache_get().", 
        'type' => 'int', 
        'not null' => TRUE, 
        'default' => 0,
      ), 
      'session' => array(
        'description' => 'The serialized contents of $_SESSION, an array of name/value pairs that persists across page requests by this session ID. Drupal loads $_SESSION from here at the start of each request and saves it at the end.', 
        'type' => 'blob', 
        'not null' => FALSE, 
        'size' => 'big',
      ),
    ), 
    'primary key' => array(
      'sid',
      'ssid',
    ), 
    'indexes' => array(
      'timestamp' => array('timestamp'), 
      'uid' => array('uid'), 
      'ssid' => array('ssid'),
    ), 
    'foreign keys' => array(
      'session_user' => array(
        'table' => 'users', 
        'columns' => array('uid' => 'uid'),
      ),
    ),
  );

但这不是一个E-R模型。此外,这在很大程度上取决于Drupal自己的会话处理功能。

感谢您的回答,这给了我们启示。现在我想知道:这个会话上次请求页面时的Unix时间戳。PHP会自动清除旧记录。->这对统计数据不好吗?我也很惊讶主键是SID和SSID。@勒巴德-SID和SSID是唯一的,所以它们是主键也就不足为奇了。此会话上次请求页面时的Unix时间戳。PHP会自动清除旧记录。这在正常会话存储上也适用,即初始化会话时,会在文件系统上的目录(通常位于/tmp/目录下)中创建文件,当会话不再有效时,会自动删除该文件。数据库方法正在做完全相同的事情。如果要进行统计,则需要登录到另一个表。