普通网友 2011-03-22 16:33
浏览 20
已采纳

不知道如何存储一些数据

I'm making a website that lets you share your music tastes, it works with a desktop client that monitors your media player (iTunes, whatever), and sends the details of the song that is currently playing to the site, where it is associated with your profile.

This output is displayed on your profile, and the idea is the page mirrors your local music player, right down the the position of a progress bar.

However I can't decide how to store the data. As soon as the song is over, it becomes useless, so something permanent like a MySQL database seems pointless.

Session variables don't work, because the script that does the work is not directing you to the page that displays the output. The idea is that the backend script just gets the info as it arrives and saves it somewhere, and you can get the latest info whenever you load the profile page.

I'm currently using a textfile, as a bad and temporary solution, just writing a new line each time and then reading it.

What is there between session variables and SQL?

And how can I get the output page to update every time there is new data? I need a way of storing it that allows events to be triggered, so checking it mustn't be too intensive.

  • 写回答

4条回答 默认 最新

  • dongsashe6006 2011-03-22 16:38
    关注

    I think a (My)SQL database would be alright, especially if you want to show the last few songs somebody played.

    But if you just need a temporary data store to hold a single song per user, you could use a key-value store like memcached. It stores data directly in memory instead of a file or database. The key would be something unique (like the user's name or id) and the value would be data about the currently playing song.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题