| 265 | } |
| 266 | |
| 267 | bool session::del(const char* name) |
| 268 | { |
| 269 | // ֱ�Ӳ������ cache ��������ɾ�������ֶ� |
| 270 | |
| 271 | if (!get_attrs(attrs_)) { |
| 272 | return true; |
| 273 | } |
| 274 | |
| 275 | std::map<string, session_string>::iterator it = attrs_.find(name); |
| 276 | if (it == attrs_.end()) { |
| 277 | return false; |
| 278 | } |
| 279 | |
| 280 | // ��ɾ�����ͷŶ�Ӧ�Ķ��� |
| 281 | attrs_.erase(it); |
| 282 | |
| 283 | // ��� sid ���Ѿ�û�������ݣ���Ӧ�ý� sid ����� memcached ��ɾ�� |
| 284 | if (attrs_.empty()) { |
| 285 | // �����麯����ɾ���� sid ��Ӧ�Ļ������� |
| 286 | if (!this->remove()) { |
| 287 | logger_error("del sid(%s) error", sid_.c_str()); |
| 288 | return false; |
| 289 | } |
| 290 | return true; |
| 291 | } |
| 292 | |
| 293 | // ��������ʣ������� |
| 294 | |
| 295 | if (!set_attrs(attrs_)) { |
| 296 | logger_error("set cache error, sid(%s)", sid_.c_str()); |
| 297 | attrs_clear(attrs_); // ������Լ������� |
| 298 | |
| 299 | return false; |
| 300 | } |
| 301 | |
| 302 | attrs_clear(attrs_); // ������Լ������� |
| 303 | return true; |
| 304 | } |
| 305 | |
| 306 | // ���� handlersocket �ı��뷽ʽ |
| 307 | |