forked from spring-attic/spring-data-aerospike
-
Notifications
You must be signed in to change notification settings - Fork 29
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
FMWK-278 Refactor configuration #684
Merged
Merged
Changes from 4 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
dd86104
refactor configuration, read from application.properties
agrgr 0ff2585
cleanup, roll back getClientPolicy() method
agrgr 1976133
support getHosts() and nameSpace() methods along with application.pro…
agrgr a3e0a0d
add default values for settings, cleanup
agrgr 0a71d01
parse hosts using Java client's method, documentation update
agrgr 5be0c15
cleanup
agrgr d3246e0
rename settings class, documentation update
agrgr d3ab858
cleanup
agrgr 80ff22a
set priority to configuration methods
agrgr 66e8dea
cleanup
agrgr d0c3b57
cleanup, documentation update
agrgr 872fbb1
cleanup
agrgr a8290b3
support modular override of data settings, remove 'sendKey' parameter…
agrgr 0877dd8
replace overrideable method for data settings, cleanup
agrgr 6df65db
cleanup
agrgr 701861e
add copyright headers
reugn 2c50f58
remove sendKey from application.properties
agrgr 2cc2cb9
Merge remote-tracking branch 'origin/FMWK-278-external-configuration'…
agrgr 925cd78
Merge branch 'main' into FMWK-278-external-configuration
reugn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,17 +206,17 @@ public class UserController { | |
|
||
=== Add @EnableCaching | ||
|
||
==== SimpleSpringbootAerospikeCacheApplication | ||
==== SimpleSpringBootAerospikeCacheApplication | ||
|
||
Add `@EnableCaching` to the class that contains the main method. | ||
|
||
[source,java] | ||
---- | ||
@EnableCaching | ||
@SpringBootApplication | ||
public class SimpleSpringbootAerospikeCacheApplication { | ||
public class SimpleSpringBootAerospikeCacheApplication { | ||
public static void main(String[] args) { | ||
SpringApplication.run(SimpleSpringbootAerospikeCacheApplication.class, args); | ||
SpringApplication.run(SimpleSpringBootAerospikeCacheApplication.class, args); | ||
} | ||
} | ||
---- | ||
|
@@ -252,7 +252,7 @@ aql> select * from test | |
+-----+-----------+----------+-------------+-------------------------------------+ | ||
| @user_key | name | @_class | email | age | | ||
+-----+-----------+----------+-------------+-------------------------------------+ | ||
| "1" | "guthrie" | "com.aerospike.cache.simplespringbootaerospikecache.objects.User" | "[email protected]" | 35 | | ||
| "1" | "guthrie" | "com.aerospike.cache.simpleSpringBootAerospikeCache.objects.User" | "[email protected]" | 35 | | ||
+-----+-----------+----------+-------------+-------------------------------------+ | ||
---- | ||
|
||
|
@@ -315,6 +315,6 @@ aql> select * from test | |
+-----+-----------+----------+-------------+-------------------------------------+ | ||
| @user_key | name | @_class | email | age | | ||
+-----+-----------+----------+-------------+-------------------------------------+ | ||
| "1" | "jimmy page" | "com.aerospike.cache.simplespringbootaerospikecache.objects.User" | "[email protected]" | 77 | | ||
| "1" | "jimmy page" | "com.aerospike.cache.simpleSpringBootAerospikeCache.objects.User" | "[email protected]" | 77 | | ||
+-----+-----------+----------+-------------+-------------------------------------+ | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,20 @@ | ||
[[scan-operation]] | ||
= Scan Operation | ||
|
||
A scan can be an expensive operation as all records in the set must be read by the Aerospike server, and then the condition is applied to see if they match. | ||
A scan can be an expensive operation as all records in the set must be read by the Aerospike server, | ||
and then the condition is applied to see if they match. | ||
|
||
Due to the cost of performing this operation, scans from Spring Data Aerospike are disabled by default. | ||
|
||
== Enabling Scan | ||
|
||
If the cost of the scans is acceptable to an organization, they can be enabled by setting xref:#configure-data-settings.scans-enabled[`scansEnabled`] to `true` in `AerospikeDataSettings`. | ||
If the cost of the scans is acceptable to an organization, they can be enabled by setting | ||
xref:#configuration.scans-enabled[`scansEnabled`] to `true` in `application.properties`. | ||
|
||
One way to do this is to create a custom bean which overrides the default settings: | ||
|
||
[source,java] | ||
[source,properties] | ||
---- | ||
@Configuration | ||
@EnableAerospikeRepositories(basePackageClasses = { PersonRepository.class}) | ||
public class AerospikeConfiguration extends AbstractAerospikeDataConfiguration { | ||
@Override | ||
protected Collection<Host> getHosts() { | ||
return Collections.singleton(new Host("localhost", 3000)); | ||
} | ||
|
||
@Override | ||
protected String nameSpace() { | ||
return "test"; | ||
} | ||
|
||
@Bean | ||
public AerospikeDataSettings aerospikeDataSettings() { | ||
return AerospikeDataSettings.builder().scansEnabled(true).build(); | ||
} | ||
} | ||
spring-data-aerospike.scans-enabled=true | ||
---- | ||
|
||
NOTE: Once this flag is enabled, scans run whenever needed with no warnings. This may or may not be optimal in a particular use case. | ||
NOTE: Once this flag is enabled, scans run whenever needed with no warnings. | ||
This may or may not be optimal in a particular use case. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only aerospikeSettings we need in template is currently namespace but it makes sense to pass the entire aerospikeSettings to the template for more modular code flow (in case we want to use an aerospike setting in the template), WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall agree, but it might be more suitable to do in a separate ticket.