-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need to support upsert function in Laravel 10 #2718
Labels
Comments
zyz954489346
changed the title
Need to support upsert method in Laravel 10
Need to support upsert function in Laravel 10
Feb 2, 2024
Thanks for reporting this issue. It's tracked in Jira: PHPORM-141 |
3 tasks
GromNaN
added a commit
that referenced
this issue
Apr 22, 2024
Fix fo PHPORM-99 In theory, we can use DatabaseStore and DatabaseLock. But various issues prove the changing nature of their implementation, based on new features in the query builder, make this feature unstable for MongoDB users. fix #2718, fix #2609 By introducing dedicated drivers, we can optimize the implementation to use the mongodb library directly instead of the subset of features provided by Laravel query builder. Usage: # config/cache.php return [ 'stores' => [ 'mongodb' => [ 'driver' => 'mongodb', 'connection' => 'mongodb', 'collection' => 'cache', 'lock_connection' => 'mongodb', 'lock_collection' => 'cache_locks', 'lock_lottery' => [2, 100], 'lock_timeout' => '86400', ] ] ] Cache: // Store any value into the cache. The value is serialized in MongoDB Cache::set('foo', [1, 2, 3]); // Read the value dump(Cache::get('foo')); // Clear the cache Cache::flush(); Lock: // Get an unique lock. It's very important to keep this object in memory // so that the lock can be released. $lock = Cache::lock('foo'); $lock->block(10); // Wait 10 seconds before throwing an exception if the lock isn't released // Any time-consuming task sleep(5); // Release the lock $lock->release();
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description:
The implementation of Cache's put function is modified to db's upsert function in Laravel10.
Steps to reproduce
When the driver of cache is changed to mongodb,This will lead to an error. Such as this:
The error is: This database engine does not support upserts.
The text was updated successfully, but these errors were encountered: