Wordpress session management

前端 未结 4 1543
清酒与你
清酒与你 2020-12-01 05:49

I\'m putting up a site using Wordpress and I\'d like to piggyback on its sessions. But I\'m not finding any plugins, or even documentation. Any suggestions or references bef

4条回答
  •  鱼传尺愫
    2020-12-01 06:04

    Consider using WordPress Transient API

    Values stored using the Transient API are visible to all users, not just the current user, depending on the unique identifier used to retrieve the transient, you could assign each user a unique identifier essentially causing a transient to behave very much like a session.

    Further considerations:

    • Depending on a users setup with object cache, etc., transients may not always be stored in the DB (e.g. memcached), using transients for sessions could mean that the data can get bulky and fill memory quickly (in the use of memcached).

    • Also, it seems that WP does not do auto garbage collection for transients: https://wordpress.stackexchange.com/questions/6602/are-transients-garbage-collected

提交回复
热议问题