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
{ | |
"took": 130, | |
"timed_out": false, | |
"_shards": { | |
"total": 8, | |
"successful": 8, | |
"failed": 0 | |
}, | |
"hits": { | |
"total": 1731, |
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
__author__ = 'itasyurt' | |
class BinaryTreeNode: | |
def __init__(self, value): | |
self.value = value | |
self.left = None | |
self.right = None |
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
"scbEnrollIds": [ | |
{ | |
"score": 0.9642999768257141, | |
"id": 1193132 | |
}, | |
{ | |
"score": 0.9640020132064819, | |
"id": 1468176 | |
}, | |
{ |
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
"scbEnrollIds": [ | |
{ | |
"score": 0.9642999768257141, | |
"id": 1193132 | |
}, | |
{ | |
"score": 0.9640020132064819, | |
"id": 1468176 | |
}, | |
{ |
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
package com.udemy.kotlin.misc | |
data class Bolt(val size: Int) | |
data class Nut(val size: Int) | |
var counter = 0 | |
fun compare(bolt: Bolt, nut: Nut): Int { | |
counter += 1 |
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
@Cacheable("upper") | |
fun getUpper(param: String): String { | |
Thread.sleep(1000) | |
return param.toUpperCase() | |
} |
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
@CachePut("upper") | |
fun setUpper(param: String): String { | |
return param.toUpperCase() | |
} | |
@CacheEvict("upper") | |
fun removeUpper(param: String) { | |
println("$param removed!") | |
} |
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
class ListCacheManager : AbstractCacheManager() { | |
var caches = mutableListOf<Cache>() | |
var cacheMap = mutableMapOf<String, Cache>() | |
override fun loadCaches() = caches | |
override fun getCache(name: String): Cache { | |
if (name in cacheMap) { | |
return cacheMap[name]!! | |
} else { |
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
@Bean | |
override fun cacheManager() = ListCacheManager() |
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
class ListCache(private val cacheName: String) : Cache { | |
override fun getName() = this.cacheName | |
private val cacheItems = mutableListOf<Pair<String, Any?>>() | |
override fun get(key: Any): Cache.ValueWrapper? { | |
val value = cacheItems.firstOrNull { it.first == key }?.second | |
return if (value != null) SimpleValueWrapper(value) else null | |
} |
OlderNewer