3
有没有什么方法可以实时检测 mysql 数据库中某个值是否发生改变?
source link: https://www.v2ex.com/t/797361
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
我现在是用一个 while 循环每隔一秒钟查询一次来判断的,有没有什么其他方法可以实现这个需求? 谢谢
5 条回复 • 2021-08-23 00:57:13 +08:00
Ackvincent 3 分钟前
@lishunan246
@mtrec
@qiyuey
@dorothyREN
我现在代码是这样 感觉很蠢得样子
```python
while True:
print('start check')
action = mysql.get_action()
if action == 'turn_on':
turn_on_the_light()
elif action == ''turn_off':
turn_off_the_light()
else:
time.sleep(1)
continue
```
@mtrec
@qiyuey
@dorothyREN
我现在代码是这样 感觉很蠢得样子
```python
while True:
print('start check')
action = mysql.get_action()
if action == 'turn_on':
turn_on_the_light()
elif action == ''turn_off':
turn_off_the_light()
else:
time.sleep(1)
continue
```
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK