@@ -62,7 +62,7 @@ public function add(string $key, mixed $data, ?int $time = null): bool
6262
6363 $ time = date ("Y-m-d H:i:s " );
6464
65- return $ this ->query ->insert (['keyname ' => $ key , "data " => serialize ($ content ), "expire " => $ time ]);
65+ return $ this ->query ->insert (['key_name ' => $ key , "data " => serialize ($ content ), "expire " => $ time ]);
6666 }
6767
6868 /**
@@ -71,7 +71,7 @@ public function add(string $key, mixed $data, ?int $time = null): bool
7171 */
7272 public function has (string $ key ): bool
7373 {
74- return $ this ->query ->where ("keyname " , $ key )->exists ();
74+ return $ this ->query ->where ("key_name " , $ key )->exists ();
7575 }
7676
7777 /**
@@ -91,14 +91,14 @@ public function update(string $key, mixed $data, ?int $time = null): mixed
9191 $ content = $ data ;
9292 }
9393
94- $ result = $ this ->query ->where ("keyname " , $ key )->first ();
94+ $ result = $ this ->query ->where ("key_name " , $ key )->first ();
9595 $ result ->data = serialize ($ content );
9696
9797 if (!is_null ($ time )) {
9898 $ result ->expire = date ("Y-m-d H:i:s " , strtotime ($ result ->expire ) + $ time );
9999 }
100100
101- return $ this ->query ->where ("keyname " , $ key )->update ((array )$ result );
101+ return $ this ->query ->where ("key_name " , $ key )->update ((array )$ result );
102102 }
103103
104104 /**
@@ -135,12 +135,12 @@ public function push(string $key, array $data): bool
135135 throw new Exception ("The key $ key is not found " );
136136 }
137137
138- $ result = $ this ->query ->where ("keyname " , $ key )->first ();
138+ $ result = $ this ->query ->where ("key_name " , $ key )->first ();
139139
140140 $ value = (array )unserialize ($ result ->data );
141141 $ result ->data = serialize (array_merge ($ value , $ data ));
142142
143- return (bool )$ this ->query ->where ("keyname " , $ key )->update ((array )$ result );
143+ return (bool )$ this ->query ->where ("key_name " , $ key )->update ((array )$ result );
144144 }
145145
146146 /**
@@ -154,11 +154,11 @@ public function addTime(string $key, int $time): bool
154154 throw new Exception ("The key $ key is not found " );
155155 }
156156
157- $ result = $ this ->query ->where ("keyname " , $ key )->first ();
157+ $ result = $ this ->query ->where ("key_name " , $ key )->first ();
158158
159159 $ result ->expire = date ("Y-m-d H:i:s " , strtotime ($ result ->expire ) + $ time );
160160
161- return (bool )$ this ->query ->where ("keyname " , $ key )->update ((array )$ result );
161+ return (bool )$ this ->query ->where ("key_name " , $ key )->update ((array )$ result );
162162 }
163163
164164 /**
@@ -172,7 +172,7 @@ public function timeOf(string $key): int|bool|string
172172 throw new Exception ("The key $ key is not found " );
173173 }
174174
175- $ result = $ this ->query ->where ("keyname " , $ key )->first ();
175+ $ result = $ this ->query ->where ("key_name " , $ key )->first ();
176176
177177 return $ result ->expire ;
178178 }
@@ -188,7 +188,7 @@ public function forget(string $key): bool
188188 throw new Exception ("The key $ key is not found " );
189189 }
190190
191- return $ this ->query ->where ("keyname " , $ key )->delete ();
191+ return $ this ->query ->where ("key_name " , $ key )->delete ();
192192 }
193193
194194 /**
@@ -210,7 +210,7 @@ public function get(string $key, mixed $default = null): mixed
210210 return is_callable ($ default ) ? $ default () : $ default ;
211211 }
212212
213- $ result = $ this ->query ->where ("keyname " , $ key )->first ();
213+ $ result = $ this ->query ->where ("key_name " , $ key )->first ();
214214
215215 $ value = unserialize ($ result ->data );
216216
0 commit comments